Project

General

Profile

API - Reports

API Reports se foloseste pentru a citi lista de apeluri din centrala

API URL

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

Datele se trasmit prin POST sau GET si trebuie sa fie de forma:

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
)

Parametrul data trebuie sa contina type = custom sau standard si ID-ul raportului (numeric pentru custom, text pentru standard, ex: cdr_api).
Parametrul page este implicit 1, va trebui incrementat pentru a extrage datele de pe toate paginile.

Headere HTTP:

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

Filtre:

  • date_between: intervalul pentru care se face filtrare

Exemplu generare parametri:

$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)
    )
);

Exemplu generare hash:

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

Exemplu trimitere date:

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

Raspuns

In caz de succes:

{

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

}

Sau in caz de eroare:

{

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

}

Disponibil si in alte limbi: EN