Project

General

Profile

API - Queues Stats

API Queues Stats is used to extract statistics about queues from the PBX

URL API

https://[YOUR-PBX-URL]/api/queues

The data is transmitted via POST or GET and must be of the form:

Array
(
 [action] => read
 [date] => Array
 (
 [queue_status] => true
 )
 [filters] => Array
 (
 [queues] => Array
 (
 [0] => demo-queue
 [1] => sales-queue
 )
 [date_between] => Array
 (
 [0] => 2023-01-01 00:00:00
 [1] => 2023-01-01 23:59:59
 )
 )

 [api_hash] => 07112231a9c89f5b108af08608a97b07
)

The action parameter must have the value read.

HTTP headers:

Content-Type: text/xml
Authorization: Bearer <token>

Filters:

  • project_id: Project ID in the PBX
  • queues: the queues names

Parameter generation example:

$params = array(
  'action' => 'info',
  'data' => array(
  'queue_status' => true
  ),
  'filters' => array(
  'queues' => array('demo-queue', 'sales-queue'),
  'date_between' => array('2023-01-01 00:00:00', ' 2023-01-01 23:59:59'), // array(from, to)
  )
);

Hash generation example:

$params['api_hash'] = md5(http_build_query($params) . 'your_api_key'); // make hash

Example of sending data:

$url = 'https://[YOUR-PBX-URL]/api/queues';
$token = 'your_api_token';
echo curlPost($url, http_build_query($params), array("Authorization: Bearer {$token}"));

Data sent JSON

{
  "action": "info",
  "data": {
    "queue_status": true
  },
  "filters": {
    "queues": [
      "demo-queue",
      "sales-queue" 
    ],
    "date_between": [
      "2023-01-01 00:00:00",
      " 2023-01-01 23:59:59" 
    ]
  },
  "api_hash": "27a081a1267f30fe7261c99f6a50b9ca" 
}

Response

In case of success:

{

 "has_error": false,
 "messages": [ ],
 "results": [ ]

}

Or in case of error:

{

 "has_error": true,
 "messages": [
 "No Queues found" 
 ],
 "results": [ ]

}

Available in other languages: RO