API - Queues Save¶
API Queues is used to read the PBX queues
API URL¶
https://[YOUR-PBX-URL]/api/queues
The data is transmitted by POST or GET and must be of the form:¶
Array
(
[api_username] => your_api_usr
[api_password] => your_api_pass
[action] => save
[data] => Array
(
[demo-queue] => Array
(
[members] => Array
(
[john-doe] => Array
(
[type] => sip
[penalty] => 0
[order] => 0
[is_active] => 1
)
[jane-doe] => Array
(
[type] => fallback
[penalty] => 0
[order] => 0
[is_active] => 1
)
[+40123456789] => Array
(
[type] => remote
[penalty] => 0
[order] => 0
[is_active] => 1
)
)
)
)
[api_hash] => 07112231a9c89f5b108af08608a97b07
)
The parameter action must have the value save. For each user the parameter is_active is mandatory.
WARNING: If no user is sent to the list, all users will be deleted.
Example of parameters generation:
$params = array(
'api_username' => 'your_api_usr',
'api_password' => 'your_api_pass',
'action' => 'save',
'data' => array(
'demo-queue' => array(
'members' => array(
'john-doe' => array(
'type' => 'sip',
'penalty' => 0,
'order' => 0,
'is_active' => 1
),
'jane-doe' => array(
'type' => 'fallback',
'penalty' => 0,
'order' => 0,
'is_active' => 1
),
'+40123456789' => array(
'type' => 'remote',
'penalty' => 0,
'order' => 0,
'is_active' => 1
)
)
)
)
);
Example of hash generation:
$params['api_hash'] = md5(http_build_query($params) . 'your_api_key'); // make hash
Example of sending data:
$url = 'https://[YOUR-PBX-URL]/api/queues';
header('Content-Type: application/json');
echo curlPost($url, $params);
Data sent JSON¶
{
"action": "save",
"data": {
"demo-queue": {
"members": {
"john-doe": {
"type": "sip",
"penalty": 0,
"order": 0,
"is_active": 1
},
"jane-doe": {
"type": "fallback",
"penalty": 0,
"order": 0,
"is_active": 1
},
"+40123456789": {
"type": "remote",
"penalty": 0,
"order": 0,
"is_active": 1
}
}
}
},
"api_hash": "d8f317d9c98cfa2b14e5049ca4b1af81"
}
Response¶
In case of successful response:
{
"has_error": false,
"messages": [ ],
"results": [ ]
}
Or in case of error:
{
"has_error": true,
"messages": [
"Invalid Queue name: demo-queuex"
],
"results": [ ]
}
Available in other languages: RO