Answer the question
In order to leave comments, you need to log in
How to get the entire list of calls from Bitrix24 (telephony) REST API?
Hello.
The task is simple at first glance. You need to get the entire list of calls for the day. I use PHP
$webhook = 'https://test.bitrix24.ua/rest/1/.../voximplant.statistic.get'; //
$data = http_build_query([
// array code...
'SORT' => 'ID',
'ORDER' => 'DESC',
'filter' => [
'>CALL_START_DATE' => date('Y').'-'.date('m').'-'.date('d'),
// 'CALL_FAILED_CODE' => [304],
]
]);
$curl = curl_init();
curl_setopt_array($curl, [
// array code...
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $webhook,
CURLOPT_POSTFIELDS => data(),
]
);
$result = curl_exec($curl);
$result = json_decode($result, 1);
echo '<pre>';
print_r($result['result']);
echo '</pre>';
// пример массива
$array = [
'result' => [
/*
Принятый звонок (перезвонили) в 18:00:00
номер: 08001234567
код: 200
! Значит запись с ключем 20 не показывать
*/
0 => [
'ID' => '100',
'USER_NUMBER' => '08001234567',
'CODE' => '200',
'DATE' => '2020.03.05Т18:00:00+03:00'
],
/*
Пропущенный звонок в 10:00:00
номер: 08001234567
код: 304
*/
20 => [
'ID' => '80',
'USER_NUMBER' => '08001234567',
'CODE' => '304',
'DATE' => '2020.03.05Т10:00:00+03:00'
],
/*
Пропущенный звонок в 08:00:00
номер: 08000000777
код: 304
! Данный звонок показать, так-как на него еще
нет записи с кодом 200.
*/
45 => [
'ID' => '60',
'USER_NUMBER' => '08000000777',
'CODE' => '304',
'DATE' => '2020.03.05Т08:00:00+03:00'
],
]
];
Answer the question
In order to leave comments, you need to log in
https://dev.1c-bitrix.ru/rest_help/general/lists.php
When calling list methods, REST returns additional values in the response:
To get the next batch of elements, you must execute the same request, specifying an additional start parameter with the value that came in the next parameter of the response.
In some cases, it becomes necessary to send several requests in a row. You can use batch query execution to streamline the process.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question