V 2.0
Analysis
Overview
The Analysis API is designed to manage and monitor call counters. It ensures that every incoming call is counted and incremented accordingly, providing real-time insights into call activities.
Key Concepts:
-
Call Counters:
-
When a call enters the system, a counter is incremented to represent the event.
-
This data is categorized based on various parameters such as type (inbound, outbound), campaign, agent, etc.
-
-
Hits Counters:
-
When a call is received by an agent, the system increments the counter on behalf of the agent.
-
This provides granular tracking of call interactions at the agent level.
-
By aggregating these counters, the API delivers detailed analytics on call activities, enabling businesses to monitor performance effectively.
Error Codes
Error Code | Message | Description |
---|---|---|
1000 | Invalid parameter | One or more request parameters are invalid. |
1001 | Invalid data type | The data type of a parameter is incorrect. |
1002 | UserId not provided | The userId parameter is missing. |
1010 | Error in DB connect | Database connection error occurred. |
1015 | Permission denied | User does not have permission to access this API. |
1043 | Agent is not logged in | The agent is not currently logged in. |
1501 | Connection issue | Could not connect to the backend system. |
1586 | Data not found | No data available for the provided parameters. |
Hits Analysis
Endpoint
-
Method: POST
-
Path:
deepcall/api/v2/analysis/call
Description:
The /hits/
endpoint provides detailed information on counters at the agent level. When a call is assigned to or answered by an agent, the corresponding counter is incremented. This endpoint is used to analyze individual agent performance or call distribution across agents.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ssid | String | Optional | Session ID for the user's session. |
userId | String | Yes | Unique identifier for the user. |
token | String | Yes | Authorization token. |
filter | Array | No | Array of filter conditions (e.g., date range, call type). |
extra | Array | No | Additional filter criteria (e.g., specific agents or call types). |
breakDown | String | No | Field to break down data (e.g., agentId , callType ). Default: agentId . |
disPlay | String | No | Field to display aggregation (e.g., date , callType ). Default: date . |
fields | Array | No | Fields for aggregation. Refer to the fields table. |
multi | Boolean | No | Whether to enable multi-level aggregation. Default: false . |
Response
Field | Description |
---|---|
data | Object containing granular call data for agents. |
status | Status of the operation (success or error ). |
code | HTTP status code. |
Fields and Descriptions
Field | Description |
---|---|
UC | Unique Call |
TC | Approached Call |
MC | Missed Counts |
AC | Answered Count |
CM | Completely Missed |
PM | Partially Missed |
CA | Completely Answered |
FR_CAN_FR_PM_N | Retried and Answered Count Description |
GH_UC | Ghost Calls Unique |
FR_UC | FailOver Retry Unique Call |
FR_CM | FailOver Retry Completely Missed |
FR_PM | FailOver Retry Partially Missed |
FR_CA | FailOver Retry Completely Answered |
avgRingTime | Average Ring Time |
avgHoldTime | Average Hold Time |
Hits Analysis
var axios = require('axios');
var data = '{ "ssid":"{{ssid}}", "fileds":["TH"],"filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]}';
var config = {
method: 'post',
url: '{{brand}}/api/v2/analysis/hits',
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/analysis/hits');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Length' => ''
));
$request->setBody('{ "ssid":"{{ssid}}", "fileds":["TH"],"filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]}');
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}}\", \"fileds\":[\"TH\"],\"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]}"
headers = {
'Content-Length': ''
}
conn.request("POST", "/api/v2/analysis/hits", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/analysis/hits");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{" + "\n" +
@" ""ssid"":""{{ssid}}""," + "\n" +
@" ""fileds"":[""TH""]," + "\n" +
@" ""filter"":[{""key"":""date"",""condi"":""range"",""val"":""11 18 2024 00:00:00,11 18 2024 23:59:59""}]" + "\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/analysis/hits' \
--data-raw '{
"ssid":"{{ssid}}",
"fileds":["TH"],
"filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]
}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/analysis/hits'));
request.body = '''{\n "ssid":"{{ssid}}",\n "fileds":["TH"],\n "filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]\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/analysis/hits"
method := "POST"
payload := strings.NewReader(`{
"ssid":"{{ssid}}",
"fileds":["TH"],
"filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]
}`)
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/analysis/hits HTTP/1.1
Host: {{brand}}
Content-Length: 143
{
"ssid":"{{ssid}}",
"fileds":["TH"],
"filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n \"ssid\":\"{{ssid}}\",\n \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\n}");
Request request = new Request.Builder()
.url("{{brand}}/api/v2/analysis/hits")
.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 \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\n}";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("{{brand}}/api/v2/analysis/hits", 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/analysis/hits");
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 \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\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/analysis/hits"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"ssid\":\"{{ssid}}\",\n \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\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 \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\n}";;
let reqBody =
let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/analysis/hits" 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 `"fileds`":[`"TH`"],`n `"filter`":[{`"key`":`"date`",`"condi`":`"range`",`"val`":`"11 18 2024 00:00:00,11 18 2024 23:59:59`"}]`n}"
$response = Invoke-RestMethod '{{brand}}/api/v2/analysis/hits' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "net/http"
url = URI("{{brand}}/api/v2/analysis/hits")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Length"] = ""
request.body = "{\n \"ssid\":\"{{ssid}}\",\n \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\n}"
response = http.request(request)
puts response.read_body
printf '{
"ssid":"{{ssid}}",
"fileds":["TH"],
"filter":[{"key":"date","condi":"range","val":"11 18 2024 00:00:00,11 18 2024 23:59:59"}]
}'| http --follow --timeout 3600 POST '{{brand}}/api/v2/analysis/hits' \
Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"ssid\":\"{{ssid}}\",\n \"fileds\":[\"TH\"],\n \"filter\":[{\"key\":\"date\",\"condi\":\"range\",\"val\":\"11 18 2024 00:00:00,11 18 2024 23:59:59\"}]\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{brand}}/api/v2/analysis/hits")!,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":"Thu
21 Nov 2024 08:52:23 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"41"}
{"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\/\"29-mA7WNmbAw5CnhahQmffAT+DzuBg\""}
{"key":"Strict-Transport-Security"
"value":"max-age=31536000; includeSubDomains"}]
{
"data": {},
"status": "success",
"code": 200
}