Project

General

Profile

API - Reports

API Reports is used to read the list of calls from the PBX

API URL

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

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

Array
(
    [page] => 1
    [data] => Array
        (
            [type] => custom
            [id] => 2
        )
    [filters] => Array
        (
            [date_between] => Array
                (
                    [0] => 2024-01-01 00:00:00
                    [1] => 2024-01-15 23:59:59
                )
        )

    [api_hash] => 07112231a9c89f5b108af08608a97b07
)

The data parameter must contain type = custom or standard and the ID of the report (numeric for custom, text for standard ex: cdr_api).
The page parameter is 1 by default, it will need to be incremented to extract data from all pages.

Headere HTTP:

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

Filters:

  • date_between: the range for which filtering is done

Parameter generation example:

$params = array(
    'page' => 1,
    'data' => array(
        'type' => 'custom', // standard
        'id' => 2 // cdr_api
    ),
    'filters' => array(
        'date_between' => array('2024-01-01 00:00:00', '2024-01-15 23:59:59'), // array(from, to)
    )
);

Hash generation example:

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

Sending data example:

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

Response

In case of success:

{

    "has_error": false,
    "messages": [ ],
    "pagination": {
        "row_count": 0,
        "page_size": 100,
        "current_page": 0,
        "max_page": 0
    },
    "results": [ ]

}

Or in case of error:

{

    "has_error": true,
    "messages": [
        "Invalid report ID 999" 
    ],
    "pagination": [ ],
    "results": [ ]

}

Available in other languages: RO

Go to top