V 2.0

Group

Description

The Group API allows you to manage agent groups within the system. You can create, update, delete, and list groups. Groups are used to organize agents and manage their permissions and settings collectively.

Base URL

The base URL for all API endpoints is: deepcall/api/v2/Group

Authentication

All endpoints require authentication. Use one of the following methods:

All endpoints may return the following error response:

Field Type Description
status string "error"
message string Description of the error
code number Error code

Error Codes

Code Description
1501 The 'Name' field was not provided in the request
1502 GroupId is required
1503 Group not found or not authorized

Notes

List

{{brand}}/api/v2/Group/list

Endpoint

Description

This endpoint allows you to retrieve a list of groups with various filtering options and authentication methods.

Request Details

Parameter Type Required Description
ssid string Yes* Session ID for authentication (*if userId and token not provided)
userId string Yes* User ID for authentication (*if ssid not provided)
token string Yes* Token for authentication (*if ssid not provided)
forward boolean No Used for permission checking (default: false)
quick boolean No Returns a quicker response with less detailed information
groupid string No Filter groups by specific group ID
name string No Filter groups by name (case-insensitive)

Response Details

Success Response Structure

Field Type Description
status string "success" if the operation was successful
response object Contains the group data
code number HTTP status code (200 for success)

Notes

List

var axios = require('axios');
var data = '{"userId": "{{userid}}","token":"{{token}}","quick":true,"groupId":28, "name":"m"}';

var config = {
 method: 'post',
 url: '{{brand}}/api/v2/Group/list',
 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/Group/list');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
 'follow_redirects' => TRUE
));
$request->setHeader(array(
 'Content-Length' => ''
));
$request->setBody('{"userId": "{{userid}}","token":"{{token}}","quick":true,"groupId":28, "name":"m"}');
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}}\",\"quick\":true,\"groupId\":28, \"name\":\"m\"}"
headers = {
 'Content-Length': ''
}
conn.request("POST", "/api/v2/Group/list", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/Group/list");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{" + "\n" +
@"    ""userId"": ""{{userid}}""," + "\n" +
@"  ""token"":""{{token}}""," + "\n" +
@"  ""quick"":true," + "\n" +
@"  ""groupId"":28," + "\n" +
@"   ""name"":""m""" + "\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/Group/list' \
--data-raw '{
    "userId": "{{userid}}",
  "token":"{{token}}",
  "quick":true,
  "groupId":28,
   "name":"m"
}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/Group/list'));
request.body = '''{\n    "userId": "{{userid}}",\n  "token":"{{token}}",\n  "quick":true,\n  "groupId":28,\n   "name":"m"\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/Group/list"
   method := "POST"

   payload := strings.NewReader(`{
    "userId": "{{userid}}",
  "token":"{{token}}",
  "quick":true,
  "groupId":28,
   "name":"m"
}`)

   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/Group/list HTTP/1.1
Host: {{brand}}
Content-Length: 100

{
    "userId": "{{userid}}",
  "token":"{{token}}",
  "quick":true,
  "groupId":28,
   "name":"m"
}
OkHttpClient client = new OkHttpClient().newBuilder()
   .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\n}");
Request request = new Request.Builder()
   .url("{{brand}}/api/v2/Group/list")
   .method("POST", body)
   .addHeader("Content-Length", "")
   .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Length", "");

var raw = "{\n    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\n}";

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

fetch("{{brand}}/api/v2/Group/list", 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/Group/list");
   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    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\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/Group/list"]
   cachePolicy:NSURLRequestUseProtocolCachePolicy
   timeoutInterval:10.0];
NSDictionary *headers = @{
   @"Content-Length": @""
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\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    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\n}";;

let reqBody = 
   let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/Group/list" 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    `"userId`": `"{{userid}}`",`n  `"token`":`"{{token}}`",`n  `"quick`":true,`n  `"groupId`":28,`n   `"name`":`"m`"`n}"

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

url = URI("{{brand}}/api/v2/Group/list")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Length"] = ""
request.body = "{\n    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\n}"

response = http.request(request)
puts response.read_body
printf '{
    "userId": "{{userid}}",
  "token":"{{token}}",
  "quick":true,
  "groupId":28,
   "name":"m"
}'| http  --follow --timeout 3600 POST '{{brand}}/api/v2/Group/list' \
 Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

let parameters = "{\n    \"userId\": \"{{userid}}\",\n  \"token\":\"{{token}}\",\n  \"quick\":true,\n  \"groupId\":28,\n   \"name\":\"m\"\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{brand}}/api/v2/Group/list")!,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 14:42:59 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"267"}
{"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\/\"10b-9ZTRgKH0wQytFBQXpTBgiHqw0pg\""}
{"key":"Strict-Transport-Security"
"value":"max-age=15724800; includeSubDomains"}]
 {
    "status": "success",
    "response": {
        "28": {
            "name": "Mahipal singh",
            "user_id": "29791451",
            "create_by": "29791451",
            "unique_id": 28,
            "status": 1,
            "create_date": 1731746318,
            "agents": [
                "#3 bhawesh",
                "#8 manoj",
                "#2 bhawesh"
            ]
        }
    },
    "page": 1,
    "limit": 10,
    "totalPages": 1,
    "totalItems": 1,
    "code": 200
}