Project

General

Profile

API - Queues Pause

Queues Pause API is used to pause or unpause agents in queues

API URL

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

Data is sent via POST or GET and must be of the form:

Array
(
    [action] => pause
    [data] => Array
        (
            [0] => Array
                (
                    [agent_name] => john-doe
                    [reason] => other
                    [paused] => 1
                )
        )
    [api_hash] => 07112231a9c89f5b108af08608a97b07
)
The action parameter must have the value pause. A list of agents is sent in data; each row has the mandatory parameters:
  • agent_name: the agent's username (member of at least one queue)
  • paused: 1 = pause, 0 = unpause
  • reason: the pause reason (text)

The agent is paused (or unpaused) in all the queues they are a member of. Each row is processed separately: valid rows are executed even if others have errors.

HTTP Headers:

Content-Type: application/json
Authorization: Bearer <token>

Example of parameters generation:

$params = array(
    'action' => 'pause',
    'data' => array(
        array(
            'agent_name' => 'john-doe',
            'reason' => 'other',
            'paused' => 1 // pause = 1, unpause = 0
        )
    )
);

Example of hash generation:

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

Example of sending data:

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

Data sent JSON

{
  "action": "pause",
  "data": [
    {
      "agent_name": "john-doe",
      "reason": "other",
      "paused": 1
    }
  ],
  "api_hash": "fb8423e2fbbe6178501e956f643f2e12" 
}

Response

If successful, results is keyed by the row index in data. result is 1 if the pause was started / stopped and 0 if the agent was already in the requested state:

{

    "has_error": false,
    "messages": [ ],
    "results": [
         {
            "agent_name": "john-doe",
            "user_id": "1234",
            "result": 1
         }
     ]

}

Or in case of error (Request data array is missing, Invalid data for row ... if a parameter is missing, Queue pause error for row ...: ... if the agent is not in any queue or the PBX did not execute the command):

{

    "has_error": true,
    "messages": [
        "Queue pause error for row 1: No interfaces could be matched" 
    ],
    "results": [ ]

}

Available in other languages: RO