V 2.0

Queue

Description

The Queue API provides functionality to retrieve and manage queue-related data in a call center environment. It offers detailed information about ongoing calls, agent statuses, and various queue metrics. This API is essential for call center managers and supervisors to monitor and analyze queue performance in real-time.

Authentication

All endpoints require authentication using either:

Ensure that you provide the necessary authentication parameters with each request.

Authentication Methods

  1. Session ID Authentication

    • Use the ssid parameter

    • Provides a quick and simple authentication method

  2. User ID and Token Authentication

    • Requires both userId and token parameters

    • Offers more granular access control

Error Codes

Queue API Specific Error Codes

Error Code Description Potential Cause Recommended Action
1501 Data already in processing A similar request is currently being processed Wait and retry the request after a short interval
1502 Invalid filter value The provided filter parameters are incorrect or malformed Review and correct the filter parameters

Additional Error Handling Guidelines

Best Practices

  1. Validate all input parameters before making a request

  2. Handle potential authentication failures

  3. Implement appropriate error handling and retry mechanisms

  4. Use the most specific authentication method for your use case

  5. Be mindful of request frequency to prevent server overload

Recommendation

For a complete understanding of all possible error codes and their implications, refer to the comprehensive SarvErrors documentation.

The documentation now provides a clear, structured overview of the Queue API's error handling, authentication methods, and best practices. The error codes table includes additional context like potential causes and recommended actions to help developers better understand and resolve issues.

count

{{brand}}/api/v2/queue/count

Introduction

This document provides detailed information about the Queue Count API endpoint. It includes request parameters, response formats, and examples.

Base URL

The base URL for this API endpoint is: deepcall/api/v2/queue

Authentication

Authentication is required for this endpoint using ssid (Session ID).


Queue Count

Endpoint

Description

The Queue Count endpoint provides queue statistics and analytics data including call counts, agent statistics, campaign data, and queue duration metrics.

Use Cases

Request Parameters

Parameter Type Required Description
ssid string Yes Session ID

Request Example

{
  "ssid": "{{ssid}}"
}

Response Details

Success Response

Status Code: 200

{
  "data": {
    "calls": [],
    "count": 0,
    "avC": X,
    "avR": X,
    "stA": XX,
    "st1": XXX,
    "qDura": [
      {
        "time": X,
        "total": XX,
        "drop": XX,
        "con": XX
      }
    ],
    "ag": [
      {
        "key": XX,
        "add": XXX,
        "drop": XXX,
        "con": XX,
        "pen": X,
        "process": X
      }
    ],
    "campId": [
      {
        "key": "X",
        "add": XX,
        "drop": XX,
        "con": X,
        "pen": X,
        "process": X
      }
    ],
    "st": [
      {
        "key": "X_X",
        "add": XXX,
        "drop": XXX,
        "con": XX,
        "pen": X
      }
    ],
    "grp": [
      {
        "key": X,
        "add": XXX,
        "drop": XXX,
        "con": XX,
        "pen": X,
        "process": X,
        "ass": XXX
      }
    ],
    "user": [
      {
        "key": XXXXXXXX,
        "add": XXX,
        "drop": XXX,
        "con": XX,
        "process": X,
        "pen": X,
        "ass": XXX
      }
    ],
    "did": [
      {
        "key": "XXXXXXXXXXXX",
        "add": XXX,
        "drop": XXX,
        "con": XX,
        "pen": X
      }
    ]
  },
  "chart": {},
  "window": 300,
  "status": "success",
  "code": 200,
  "lstSync": "lstSyncN"
}
Field Type Description
status string Response status ("success")
code number Response code (200)
lstSync string Last sync identifier
window number Time window in seconds
data object Queue statistics data
data.calls array Array of call records
data.count number Total count
data.qDura array Queue duration statistics
data.ag array Agent-wise statistics
data.campId array Campaign-wise statistics
data.st array Status-wise statistics
data.grp array Group-wise statistics
data.user array User-wise statistics
data.did array DID-wise statistics
chart object Chart data

Queue Duration Object

Field Type Description
time number Time in seconds
total number Total calls
drop number Dropped calls
con number Connected calls

Agent Statistics Object

Field Type Description
key number Agent ID
add number Added calls
drop number Dropped calls
con number Connected calls
pen number Pending calls
process number Processing calls

Campaign Statistics Object

Field Type Description
key string Campaign ID
add number Added calls
drop number Dropped calls
con number Connected calls
pen number Pending calls
process number Processing calls

Group Statistics Object

Field Type Description
key number Group ID
add number Added calls
drop number Dropped calls
con number Connected calls
pen number Pending calls
process number Processing calls
ass number Assigned calls

User Statistics Object

Field Type Description
key number User ID
add number Added calls
drop number Dropped calls
con number Connected calls
process number Processing calls
pen number Pending calls
ass number Assigned calls

DID Statistics Object

Field Type Description
key string DID number
add number Added calls
drop number Dropped calls
con number Connected calls
pen number Pending calls

Notes

Example cURL Request

curl -X POST "deepcall/api/v2/queue/count" \
  -H "Content-Type: application/json" \
  -d '{
    "ssid": "{{ssid}}"
  }'

count

var axios = require('axios');
var data = '{"ssid":"{{ssid}}"}';

var config = {
 method: 'post',
 url: '{{brand}}/api/v2/queue/count',
 headers: { 
'Content-Length': ''
 },
 data : data
};

axios(config)
.then(function (response) {
 console.log(JSON.stringify(response.data));
})
.catch(function (error) {
 console.log(error);
});
setUrl('{{brand}}/api/v2/queue/count');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
 'follow_redirects' => TRUE
));
$request->setHeader(array(
 'Content-Length' => ''
));
$request->setBody('{"ssid":"{{ssid}}"}');
try {
 $response = $request->send();
 if ($response->getStatus() == 200) {
echo $response->getBody();
 }
 else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
 }
}
catch(HTTP_Request2_Exception $e) {
 echo 'Error: ' . $e->getMessage();
}
import http.client

conn = http.client.HTTPSConnection("{{brand}}")
payload = "{\"ssid\":\"{{ssid}}\"}"
headers = {
 'Content-Length': ''
}
conn.request("POST", "/api/v2/queue/count", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/queue/count");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{" + "\n" +
@"    ""ssid"":""{{ssid}}""" + "\n" +
@"}";
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
curl --location -g --request POST '{{brand}}/api/v2/queue/count' \
--data-raw '{
    "ssid":"{{ssid}}"
}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/queue/count'));
request.body = '''{\n    "ssid":"{{ssid}}"\n}''';

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
   print(await response.stream.bytesToString());
}
else {
   print(response.reasonPhrase);
}
package main

import (
   "fmt"
   "strings"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "%7B%7Bbrand%7D%7D/api/v2/queue/count"
   method := "POST"

   payload := strings.NewReader(`{
    "ssid":"{{ssid}}"
}`)

   client := &http.Client {
   }
   req, err := http.NewRequest(method, url, payload)

   if err != nil {
      fmt.Println(err)
      return
   }
   res, err := client.Do(req)
   if err != nil {
      fmt.Println(err)
      return
   }
   defer res.Body.Close()

   body, err := ioutil.ReadAll(res.Body)
   if err != nil {
      fmt.Println(err)
      return
   }
   fmt.Println(string(body))
}
POST /api/v2/queue/count HTTP/1.1
Host: {{brand}}
Content-Length: 25

{
    "ssid":"{{ssid}}"
}
OkHttpClient client = new OkHttpClient().newBuilder()
   .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n    \"ssid\":\"{{ssid}}\"\n}");
Request request = new Request.Builder()
   .url("{{brand}}/api/v2/queue/count")
   .method("POST", body)
   .addHeader("Content-Length", "")
   .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Length", "");

var raw = "{\n    \"ssid\":\"{{ssid}}\"\n}";

var requestOptions = {
   method: 'POST',
   headers: myHeaders,
   body: raw,
   redirect: 'follow'
};

fetch("{{brand}}/api/v2/queue/count", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
   curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
   curl_easy_setopt(curl, CURLOPT_URL, "%7B%7Bbrand%7D%7D/api/v2/queue/count");
   curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
   curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
   struct curl_slist *headers = NULL;
   headers = curl_slist_append(headers, "Content-Length: ");
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
   const char *data = "{\n    \"ssid\":\"{{ssid}}\"\n}";
   curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
   res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
#import 

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"%7B%7Bbrand%7D%7D/api/v2/queue/count"]
   cachePolicy:NSURLRequestUseProtocolCachePolicy
   timeoutInterval:10.0];
NSDictionary *headers = @{
   @"Content-Length": @""
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n    \"ssid\":\"{{ssid}}\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];

[request setHTTPMethod:@"POST"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
   if (error) {
      NSLog(@"%@", error);
      dispatch_semaphore_signal(sema);
   } else {
      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
      NSError *parseError = nil;
      NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
      NSLog(@"%@",responseDictionary);
      dispatch_semaphore_signal(sema);
   }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let postData = ref "{\n    \"ssid\":\"{{ssid}}\"\n}";;

let reqBody = 
   let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/queue/count" in
   let headers = Header.init ()
      |> fun h -> Header.add h "Content-Length" ""
   in
   let body = Cohttp_lwt.Body.of_string !postData in

   Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
   body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
   let respBody = Lwt_main.run reqBody in
   print_endline (respBody)
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Length", "")

$body = "{`n    `"ssid`":`"{{ssid}}`"`n}"

$response = Invoke-RestMethod '{{brand}}/api/v2/queue/count' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "net/http"

url = URI("{{brand}}/api/v2/queue/count")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Length"] = ""
request.body = "{\n    \"ssid\":\"{{ssid}}\"\n}"

response = http.request(request)
puts response.read_body
printf '{
    "ssid":"{{ssid}}"
}'| http  --follow --timeout 3600 POST '{{brand}}/api/v2/queue/count' \
 Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

let parameters = "{\n    \"ssid\":\"{{ssid}}\"\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{brand}}/api/v2/queue/count")!,timeoutInterval: Double.infinity)
request.addValue("", forHTTPHeaderField: "Content-Length")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
   guard let data = data else {
      print(String(describing: error))
      semaphore.signal()
      return
   }
   print(String(data: data, encoding: .utf8)!)
   semaphore.signal()
}

task.resume()
semaphore.wait()

Example Response

 [{"key":"Date"
"value":"Fri
 14 Nov 2025 11:58:56 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"2702"}
{"key":"Connection"
"value":"keep-alive"}
{"key":"Access-Control-Allow-Origin"
"value":"*"}
{"key":"Access-Control-Allow-Methods"
"value":"GET
 PUT
 POST
 DELETE
 OPTIONS"}
{"key":"Access-Control-Allow-Headers"
"value":"session-token
Authorization
Origin
Accept
Content-Type
DNT
Authorization
Keep-Alive
User-Agent
X-Requested-With
If-Modified-Since
Cache-Control
Content-Type
Content-Range
Range"}
{"key":"Access-Control-Allow-Credentials"
"value":"true"}
{"key":"Vary"
"value":"Origin"}
{"key":"ETag"
"value":"W\/\"a8e-vzO2pv7ju78MKtuY2u+elUaH2+s\""}
{"key":"Strict-Transport-Security"
"value":"max-age=15724800; includeSubDomains"}
{"key":"Access-Control-Max-Age"
"value":"1728000"}]
 {
    "data": {
        "calls": [],
        "count": 0,
        "avC": 1,
        "avR": 0,
        "stA": 16,
        "st1": 853,
        "qDura": [
            {
                "time": 1,
                "total": 69,
                "drop": 54,
                "con": 15
            },
            {
                "time": 30,
                "total": 48,
                "drop": 48,
                "con": 0
            },
            {
                "time": 15,
                "total": 41,
                "drop": 39,
                "con": 2
            },
            {
                "time": 9,
                "total": 34,
                "drop": 32,
                "con": 2
            },
            {
                "time": 0,
                "total": 32,
                "drop": 32,
                "con": 0
            },
            {
                "time": 60,
                "total": 27,
                "drop": 27,
                "con": 0
            },
            {
                "time": 5,
                "total": 26,
                "drop": 19,
                "con": 7
            },
            {
                "time": 6,
                "total": 26,
                "drop": 9,
                "con": 17
            },
            {
                "time": 4,
                "total": 25,
                "drop": 9,
                "con": 16
            },
            {
                "time": 2,
                "total": 24,
                "drop": 20,
                "con": 4
            }
        ],
        "ag": [
            {
                "key": 21,
                "add": 152,
                "drop": 105,
                "con": 47,
                "pen": 0,
                "process": 0
            },
            {
                "key": 24,
                "add": 117,
                "drop": 117,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": 33,
                "add": 105,
                "drop": 91,
                "con": 14,
                "pen": 0,
                "process": 0
            },
            {
                "key": 4,
                "add": 58,
                "drop": 56,
                "con": 2,
                "pen": 0,
                "process": 0
            },
            {
                "key": 6,
                "add": 48,
                "drop": 35,
                "con": 13,
                "pen": 0,
                "process": 0
            },
            {
                "key": 5,
                "add": 1,
                "drop": 0,
                "con": 1,
                "pen": 0,
                "process": 0
            },
            {
                "key": 11,
                "add": 1,
                "drop": 1,
                "con": 0,
                "pen": 0,
                "process": 0
            }
        ],
        "campId": [
            {
                "key": "8",
                "add": 47,
                "drop": 47,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "9",
                "add": 25,
                "drop": 25,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "33",
                "add": 22,
                "drop": 22,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "2",
                "add": 12,
                "drop": 12,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "30",
                "add": 11,
                "drop": 11,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "60",
                "add": 6,
                "drop": 6,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "6",
                "add": 4,
                "drop": 4,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "13",
                "add": 2,
                "drop": 2,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "16",
                "add": 2,
                "drop": 2,
                "con": 0,
                "pen": 0,
                "process": 0
            },
            {
                "key": "17",
                "add": 1,
                "drop": 1,
                "con": 0,
                "pen": 0,
                "process": 0
            }
        ],
        "st": [
            {
                "key": "N_Y",
                "add": 340,
                "drop": 293,
                "con": 47,
                "pen": 0
            },
            {
                "key": "N_N",
                "add": 25,
                "drop": 25,
                "con": 0,
                "pen": 0
            },
            {
                "key": "NA_NA",
                "add": 504,
                "drop": 474,
                "con": 30,
                "pen": 0
            }
        ],
        "grp": [
            {
                "key": 0,
                "add": 642,
                "drop": 566,
                "con": 76,
                "pen": 0,
                "process": 0,
                "ass": 381
            },
            {
                "key": 67,
                "add": 187,
                "drop": 187,
                "con": 0,
                "pen": 0,
                "process": 0,
                "ass": 87
            },
            {
                "key": 29,
                "add": 23,
                "drop": 22,
                "con": 1,
                "pen": 0,
                "process": 0,
                "ass": 1
            },
            {
                "key": 28,
                "add": 15,
                "drop": 15,
                "con": 0,
                "pen": 0,
                "process": 0,
                "ass": 13
            },
            {
                "key": 20,
                "add": 1,
                "drop": 1,
                "con": 0,
                "pen": 0,
                "process": 0,
                "ass": 0
            },
            {
                "key": 22,
                "add": 1,
                "drop": 1,
                "con": 0,
                "pen": 0,
                "process": 0,
                "ass": 0
            }
        ],
        "user": [
            {
                "key": 29791451,
                "add": 869,
                "drop": 792,
                "con": 77,
                "process": 0,
                "pen": 0,
                "ass": 482
            }
        ],
        "did": [
            {
                "key": "918645363215",
                "add": 321,
                "drop": 272,
                "con": 49,
                "pen": 0
            },
            {
                "key": "CTC",
                "add": 308,
                "drop": 308,
                "con": 0,
                "pen": 0
            },
            {
                "key": "7877799966",
                "add": 46,
                "drop": 19,
                "con": 27,
                "pen": 0
            },
            {
                "key": "1DcBetaOBD_67cf2485a92195c3130eebc6_1",
                "add": 24,
                "drop": 24,
                "con": 0,
                "pen": 0
            },
            {
                "key": "918645313599",
                "add": 11,
                "drop": 10,
                "con": 1,
                "pen": 0
            },
            {
                "key": "1DcBetaOBD_67cf2485a92195c3130eebc6_2",
                "add": 8,
                "drop": 8,
                "con": 0,
                "pen": 0
            },
            {
                "key": "1DcBetaOBD_67cf2485a92195c3130eebc6_3",
                "add": 1,
                "drop": 1,
                "con": 0,
                "pen": 0
            }
        ]
    },
    "chart": {},
    "window": 300,
    "status": "success",
    "code": 200,
    "lstSync": "lstSyncN"
}