V 2.0
Agent
Introduction
This document provides detailed information about the API endpoints available in the Agent.js file. It includes request parameters, response formats, and examples for each endpoint.
Base URL
The base URL for all API endpoints is: deepcall/api/v2/Agent
Authentication
Authentication is required for all endpoints. It can be done in two ways:
-
Using
ssid
(Session ID) -
Using
userId
andtoken
Note: When userId
and token
are used, ssid
should not be present in the request.
Error Codes
Error Code | Description |
---|---|
1501 | Data already in processing |
1502 | Invalid filter value |
1503 | Invalid role id |
1504 | Invalid parent |
1505 | Invalid group data |
1506 | AgentId and parent could not be same |
1507 | Invalid AgentID |
1508 | Invalid status value |
1509 | Invalid agentId |
1510 | Invalid Destination |
1511 | Working time format is invalid |
1512 | Email already exists |
1513 | Invalid type |
1514 | Invalid mobile Number |
1515 | Invalid Name |
1516 | Invalid Did Number |
1517 | Your agentid and your loginid must be same |
1518 | Data could not be updated |
1519 | Call Password must be Integer and Eight digit |
1520 | You must be single field update |
1521 | Please Provide Only Valid fields |
1522 | You could not inserted your data. Please try again |
1523 | Your agent information is already added |
1524 | Invalid Action |
1525 | Invalid Targetagent Id |
1526 | Invalid Id |
1527 | Invalid Type |
1528 | Invalid Favorite Data |
1529 | Invalid Domain |
1530 | Invalid Agent Timing |
Live
Endpoint
- Method: POST
-
Path:
deepcall/api/v2/Agent/live/
Description
The Live Agent Stats endpoint provides real-time statistics and status information for agents. This endpoint is crucial for monitoring agent performance, availability, and current activities in a call center or customer service environment.
Use Cases
- Displaying real-time agent status on dashboards
- Monitoring agent performance in real-time
- Making informed decisions about call routing and workload distribution
- Identifying agents who may need assistance or intervention
- Generating real-time reports on agent activities
Request Details
Parameter | Type | Required | Description |
---|---|---|---|
ssid | string | No | Session ID (required if token is not used) |
userId | string | No | User ID (required if ssid is not used) |
token | string | No | Authentication token (required if ssid is not used) |
groupid | string | No | Group ID to filter agents (default: 55) |
status | string | No | Status to filter ("all" or "login") |
A | number | No | Flag for additional data (0 or 1) |
filter | array | No | Array of filter objects |
Response Details
Success Response Structure
Field | Type | Description |
---|---|---|
message.pr | array | Array of agent objects containing individual agent stats |
message.pr[].I | string | Agent ID |
message.pr[].nm | string | Agent name |
message.pr[].avT | array | Available time [hours, minutes, seconds] |
message.pr[].liC | object | Current live call information |
message.pr[].l | string | Login status |
message.pr[].ml | string | Mobile login status |
message.pr[].tt | number | Total talk time (in seconds) |
message.pr[].tC | number | Total call count |
message.pr[].ataT | array | Average talk time [hours, minutes, seconds] |
message.pr[].br | object | Current break information |
message.oCA | number | Number of agents on call |
message.oBA | number | Number of agents on break |
message.lA | number | Number of logged-in agents |
message.Dia | number | Number of agents in after-call work |
message.Ring | number | Number of agents with ringing calls |
status | string | Response status ("success") |
code | number | Response code (200 for success) |
Error Response Examples
Error Code | Description | Message |
---|---|---|
1014 | Invalid Session/Token | Invalid token |
1006 | Invalid Group ID | GroupId does not exist |
1015 | Permission Denied | Permission denied |
Notes
- Authentication can be done either through
ssid
(Session ID) oruserId
andtoken
combination - The
groupid
parameter allows filtering agents by their assigned group - Setting
status
to "login" will only return data for logged-in agents - The
A
flag, when set to 1, includes additional agent data in the response - The
filter
array can be used to apply additional filtering criteria - This endpoint provides a snapshot of the current state and may not include historical data
- The data returned is typically used for real-time monitoring and should be refreshed periodically
- Large call centers may need to implement pagination or limit the number of agents returned
- Ensure that the user making the request has the necessary permissions to view agent statistics
Live
var axios = require('axios');
var data = '{"userId":"{{userid}}","token":"{{token}}"}';
var config = {
method: 'post',
url: '{{brand}}/api/v2/Agent/live',
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/Agent/live');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Length' => ''
));
$request->setBody('{"userId":"{{userid}}","token":"{{token}}"}');
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 = "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}"
headers = {
'Content-Length': ''
}
conn.request("POST", "/api/v2/Agent/live", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/Agent/live");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{""userId"":""{{userid}}"",""token"":""{{token}}""}";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
curl --location -g --request POST '{{brand}}/api/v2/Agent/live' \
--data-raw '{"userId":"{{userid}}","token":"{{token}}"}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/Agent/live'));
request.body = '''{"userId":"{{userid}}","token":"{{token}}"}''';
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/Agent/live"
method := "POST"
payload := strings.NewReader(`{"userId":"{{userid}}","token":"{{token}}"}`)
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/Agent/live HTTP/1.1
Host: {{brand}}
Content-Length: 43
{"userId":"{{userid}}","token":"{{token}}"}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}");
Request request = new Request.Builder()
.url("{{brand}}/api/v2/Agent/live")
.method("POST", body)
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Length", "");
var raw = "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("{{brand}}/api/v2/Agent/live", 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/Agent/live");
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 = "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}";
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/Agent/live"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}" 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 "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}";;
let reqBody =
let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/Agent/live" 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 = "{`"userId`":`"{{userid}}`",`"token`":`"{{token}}`"}"
$response = Invoke-RestMethod '{{brand}}/api/v2/Agent/live' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "net/http"
url = URI("{{brand}}/api/v2/Agent/live")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Length"] = ""
request.body = "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}"
response = http.request(request)
puts response.read_body
printf '{"userId":"{{userid}}","token":"{{token}}"}'| http --follow --timeout 3600 POST '{{brand}}/api/v2/Agent/live' \
Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\"userId\":\"{{userid}}\",\"token\":\"{{token}}\"}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{brand}}/api/v2/Agent/live")!,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":"Sat
16 Nov 2024 12:19:25 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"1598"}
{"key":"Connection"
"value":"keep-alive"}
{"key":"Access-Control-Allow-Origin"
"value":"*"}
{"key":"Access-Control-Allow-Methods"
"value":"POST
GET
OPTIONS
PATCH
DELETE"}
{"key":"Access-Control-Allow-Headers"
"value":"X-Requested-With
content-type"}
{"key":"Access-Control-Allow-Credentials"
"value":"true"}
{"key":"Vary"
"value":"Origin"}
{"key":"ETag"
"value":"W\/\"63e-\/9QZd66dA5U3H0\/g7We2krINLlM\""}
{"key":"Strict-Transport-Security"
"value":"max-age=15724800; includeSubDomains"}]
{
"message": {
"pr": [
{
"nm": "AAKANSHA",
"I": "468",
"IsOcc": 0,
"l": {
"type": "Web",
"duration": [
"3434",
"36",
"12"
]
},
"ml": "No",
"avT": [
"3434",
"36",
"12"
],
"avD": 1719394993,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "Bhawna",
"I": "6",
"IsOcc": 0,
"l": {
"type": "Web",
"duration": [
"3215",
"18",
"22"
]
},
"ml": "No",
"avT": [
"3215",
"17",
"24"
],
"avD": 1720184521,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "bhawesh",
"I": "3",
"IsOcc": 0,
"l": "No",
"ml": "No",
"avT": [
"2978",
"05",
"26"
],
"avD": 1721038439,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "Manoj Kumar111",
"I": "7",
"IsOcc": 0,
"l": "No",
"ml": "No",
"avT": [
"942",
"48",
"46"
],
"avD": 1728365439,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "Brijendra",
"I": "5",
"IsOcc": 0,
"l": {
"type": "Web",
"duration": [
"698",
"47",
"04"
]
},
"ml": "No",
"avT": [
"698",
"47",
"04"
],
"avD": 1729243941,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "bhawesh",
"I": "2",
"IsOcc": 0,
"l": "No",
"ml": "No",
"avT": [
"534",
"21",
"16"
],
"avD": 1729835889,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "manoj",
"I": "8",
"IsOcc": 0,
"l": "No",
"ml": "No",
"avT": [
"533",
"18",
"39"
],
"avD": 1729839646,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "Sumit",
"I": "9",
"IsOcc": 0,
"l": "No",
"ml": "No",
"avT": [
"533",
"00",
"06"
],
"avD": 1729840759,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "vijay developer",
"I": "4",
"IsOcc": 0,
"l": {
"type": "Web",
"duration": [
"290",
"26",
"25"
]
},
"ml": "No",
"avT": [
"246",
"24",
"03"
],
"avD": 1730872522,
"mic_perm": 0,
"sip_status": "offline"
},
{
"nm": "Manoj Kumar111",
"I": "10",
"IsOcc": 0,
"l": "No",
"ml": "No",
"avT": [
"1",
"09",
"42"
],
"avD": 1731755383,
"mic_perm": 0,
"sip_status": "offline"
}
],
"oCA": 0,
"oBA": 0,
"lA": 4,
"Dia": 0,
"Ring": 0,
"sip": 0,
"mic": 0
},
"status": "success",
"code": 200
}