V 2.0
Agent Dashboard
Overview
This API facilitates interactions with an agent dashboard system. It allows for retrieving agent details, fetching recent call data, managing notes, and accessing contact information. It includes error handling for robust integration and delivers results in JSON format.
Base URL
The base URL for all API endpoints is: deepcall/api/v2/agentDashboard
Error Handling
The API uses standardized error codes for ease of troubleshooting. Below is a comprehensive list of error codes:
Error Code | Message | Description |
---|---|---|
1000 | Invalid parameter | Missing or invalid parameters in the request. |
1001 | Invalid data type | Incorrect data type provided in the request. |
1002 | UserId not provided | userId is a required field. |
1003 | AgentId does not exist | The specified agentId does not exist. |
1004 | File not found | The requested file is unavailable. |
1014 | Invalid token | The provided token is invalid or expired. |
1020 | Token not found | The request does not include a token. |
1032 | Internal server error | A general server-side error occurred. |
1039 | User account suspended | The user's account is currently suspended. |
1501 | Agent dashboard error | Issues occurred while fetching agent dashboard data. |
Recent Calls
Endpoint
-
Method: POST
-
Path:
deepcall/api/v2/agentDashboard/recentCalls
Description
Fetches recent call data for a given caller number. This endpoint provides detailed information about the recent calls associated with the specified caller number, including call type, duration, and status.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ssid |
String | Yes | Session ID of the user. |
userId |
String | Yes | Unique user ID. |
token |
String | Yes | Authentication token. |
callerNumber |
String | Yes | Caller number to fetch details for. |
Notes
- Ensure that the
callerNumber
is valid and registered in the system. - Authentication is mandatory for accessing this endpoint.
- The response includes detailed call metadata for better traceability.
Recent Calls
var axios = require('axios');
var data = '{"callerNumber":"{{callernumber}}","ssid":"{{ssid}}"}';
var config = {
method: 'post',
url: '{{brand}}/api/v2/agentDashboard/recentCalls',
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/agentDashboard/recentCalls');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Length' => ''
));
$request->setBody('{"callerNumber":"{{callernumber}}","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 = "{\"callerNumber\":\"{{callernumber}}\",\"ssid\":\"{{ssid}}\"}"
headers = {
'Content-Length': ''
}
conn.request("POST", "/api/v2/agentDashboard/recentCalls", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/agentDashboard/recentCalls");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{" + "\n" +
@" ""callerNumber"":""{{callernumber}}""," + "\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/agentDashboard/recentCalls' \
--data-raw '{
"callerNumber":"{{callernumber}}",
"ssid":"{{ssid}}"
}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/agentDashboard/recentCalls'));
request.body = '''{\n "callerNumber":"{{callernumber}}",\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/agentDashboard/recentCalls"
method := "POST"
payload := strings.NewReader(`{
"callerNumber":"{{callernumber}}",
"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/agentDashboard/recentCalls HTTP/1.1
Host: {{brand}}
Content-Length: 64
{
"callerNumber":"{{callernumber}}",
"ssid":"{{ssid}}"
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n \"callerNumber\":\"{{callernumber}}\",\n \"ssid\":\"{{ssid}}\"\n}");
Request request = new Request.Builder()
.url("{{brand}}/api/v2/agentDashboard/recentCalls")
.method("POST", body)
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Length", "");
var raw = "{\n \"callerNumber\":\"{{callernumber}}\",\n \"ssid\":\"{{ssid}}\"\n}";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("{{brand}}/api/v2/agentDashboard/recentCalls", 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/agentDashboard/recentCalls");
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 \"callerNumber\":\"{{callernumber}}\",\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/agentDashboard/recentCalls"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"callerNumber\":\"{{callernumber}}\",\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 \"callerNumber\":\"{{callernumber}}\",\n \"ssid\":\"{{ssid}}\"\n}";;
let reqBody =
let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/agentDashboard/recentCalls" 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 `"callerNumber`":`"{{callernumber}}`",`n `"ssid`":`"{{ssid}}`"`n}"
$response = Invoke-RestMethod '{{brand}}/api/v2/agentDashboard/recentCalls' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "net/http"
url = URI("{{brand}}/api/v2/agentDashboard/recentCalls")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Length"] = ""
request.body = "{\n \"callerNumber\":\"{{callernumber}}\",\n \"ssid\":\"{{ssid}}\"\n}"
response = http.request(request)
puts response.read_body
printf '{
"callerNumber":"{{callernumber}}",
"ssid":"{{ssid}}"
}'| http --follow --timeout 3600 POST '{{brand}}/api/v2/agentDashboard/recentCalls' \
Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"callerNumber\":\"{{callernumber}}\",\n \"ssid\":\"{{ssid}}\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{brand}}/api/v2/agentDashboard/recentCalls")!,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 12:41:00 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"547"}
{"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\/\"223-L6ME7FllaL\/swHTnK5fknfZ7X4g\""}
{"key":"Strict-Transport-Security"
"value":"max-age=31536000; includeSubDomains"}]
{
"data": [
{
"callId": "k144qsf1bd2szv0aneol",
"callTime": 1731676407000,
"callStatus": 7
},
{
"callId": "k13z4vc1bd2snu83ysg8",
"callTime": 1731676145000,
"callStatus": 7
},
{
"callId": "k140cm01bd2sqfz5tb44",
"callTime": 1731676202000,
"callStatus": 7
},
{
"callId": "k13msuq1bd2rxejiwwwq",
"callTime": 1731675570000,
"callStatus": 7
},
{
"callId": "k13kz6c1bd2rthru04gg",
"callTime": 1731675485000,
"callStatus": 7
},
{
"callId": "k14bzof1bd2tfe6ke3ke",
"callTime": 1731676745000,
"callStatus": 7
},
{
"callId": "k13yfql1bd2smccxgm86",
"callTime": 1731676117000,
"callStatus": 7
}
],
"status": "success"
}