V 2.0

Employee

Description

The Employee API provides comprehensive functionality to manage employees (agents) in a call center environment. It offers detailed capabilities for creating, updating, listing, and managing employee information including their roles, working hours, group assignments, and destination configurations. This API is essential for HR managers, administrators, and supervisors to maintain and monitor employee data 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

Note: When userId and token are used, ssid should not be present in the request.

Error Codes

Employee API Specific Error Codes

Error Code Description Potential Cause Recommended Action
1000 Invalid parameters The provided parameters are incorrect or malformed Review and correct the request parameters
1014 Invalid token Authentication token is invalid or expired Re-authenticate and obtain a new token
1015 Permission denied User lacks required permissions Verify user permissions (ADD_EMPLOYEE, EDIT_EMPLOYEES, VIEW_AGENTS, etc.)
1047 Invalid request (empty body) Request body is empty or not provided Ensure request body contains required data
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
1503 Invalid role id The provided role ID does not exist Verify the role ID exists in your account
1504 Invalid parent Parent employee ID is invalid or not found Provide a valid parent ID or use "root"
1505 Invalid group data Group assignment data is malformed or group IDs don't exist Verify all group IDs exist in your account
1506 Employee and parent could not be same Attempting to set employee as their own parent Choose a different parent employee
1507 Invalid AgentID The provided agent/employee ID is invalid Verify the employee ID is correct
1508 Invalid status value Status value must be 0 or 1 Use 0 for inactive, 1 for active
1509 Invalid employee Employee not found or user unauthorized to access Verify employee exists and you have access
1510 Invalid destination Destination type or value is invalid Verify destination type (MOBILE, SIP, etc.) and value
1511 Working time format is invalid Working hours are not in correct format or range Use minutes from midnight (0-1439)
1512 Email already exists The email address is already registered Use a unique email address
1513 Invalid type Employee type is invalid Use valid types: "Both", "Inbound", "Outbound"
1514 Invalid mobile number Mobile number format is incorrect Provide a valid mobile number
1515 Invalid name Employee name is empty or invalid Provide a valid employee name
1516 Invalid DID number DID number format is incorrect Verify DID number format
1517 Your agentid and your loginid must be same Agent trying to modify another agent's data Agents can only modify their own data
1518 Data could not be updated Database update operation failed Try again or contact support
1519 Call password must be minimum 6 digits (update) / 8 digits (create) Call password length requirement not met Provide password meeting length requirement
1520 You must be single field update Multiple fields provided when single field expected Update only one field at a time
1521 Please provide only valid fields Request contains invalid or unknown fields Remove invalid fields from request
1522 Data could not be inserted Database insert operation failed Try again or contact support
1523 Your agent information is already added Duplicate employee creation attempt Employee already exists with this information
1524 Invalid action The requested action is not valid Verify the action parameter
1525 Invalid target agent ID Target agent ID for operation is invalid Provide a valid target agent ID
1526 Invalid ID The provided ID is invalid Verify the ID parameter
1527 Invalid type Type parameter value is invalid Use a valid type value
1528 Invalid favorite data Favorite data format is incorrect Verify favorite data structure
1529 Invalid domain Domain parameter is invalid Provide a valid domain
1530 Invalid agent timing Agent timing data is incorrect Verify timing format and values
1532 Employee limit reached Account has reached maximum employee limit Upgrade plan or deactivate unused employees
1534 PreDelete value exceeds limit of 2 PreDelete counter exceeds maximum allowed value Contact support to resolve

Additional Error Handling Guidelines

Best Practices

  1. Validate all input parameters before making a request

  2. Handle potential authentication failures gracefully

  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

  6. Check employee limits before creating or activating employees

  7. Ensure email uniqueness across all employees

  8. Use proper working hours format (minutes from midnight: 0-1439)

  9. Validate role and group IDs before assignment

  10. Use partial updates when modifying employee data - only send fields that need to change

  11. Monitor change logs for audit trail and compliance

  12. Test with single employee before performing bulk operations

Working Hours Format

Working hours are specified in minutes from midnight (0-1439):

Example:

{
  "MON": [
    { "from": 540, "to": 1080 }  // 9:00 AM to 6:00 PM
  ],
  "TUE": [
    { "from": 540, "to": 1080 }
  ]
}

Multiple time slots per day:

{
  "MON": [
    { "from": 0, "to": 1137 },      // 12:00 AM to 6:57 PM
    { "from": 1139, "to": 1239 },   // 6:59 PM to 8:39 PM
    { "from": 1339, "to": 1439 }    // 10:19 PM to 11:59 PM
  ]
}

Destination Types

Common destination types for employee call routing:

Type Description Example Value
MOBILE Mobile phone number "9876543210"
SIP SIP endpoint/extension "sip:user@domain.com"
LANDLINE Landline phone number "0123456789"
WEBRTC WebRTC endpoint "webrtc:endpoint"

Employee Status Values

Status Value Description
Active 1 Employee is active and can receive calls
Inactive 0 Employee is inactive and cannot receive calls

Parent Hierarchy Values

Valid parent values for employee hierarchy:

Permissions Required

Different operations require different permissions:

Operation Permission
Create Employee ADD_EMPLOYEE
Update Employee EDIT_EMPLOYEES
View Employees VIEW_AGENTS or VIEW_ALL_AGENTS
Delete Employee DELETE_EMPLOYEE

Note: Permissions can be bypassed by setting forward=true in the request (admin only).

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 Employee 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.

Update

{{brand}}/api/v2/Employee/update

Introduction

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

Base URL

The base URL for this API endpoint is: {{domain}}/api/v2/Employee

Authentication

Authentication is required for this endpoint. It can be done in two ways:

  1. Using ssid (Session ID)
  2. Using userId and token

Note: When userId and token are used, ssid should not be present in the request.


Update Employee

Endpoint

Description

The Update Employee endpoint allows you to modify an existing employee's information. This endpoint supports partial updates - you only need to send the fields you want to change. The API validates all changes, tracks modifications, and updates the employee record with proper change logging.

Use Cases

Request Parameters

Parameter Type Required Description
userId string Yes* User ID for authentication (*required if ssid not provided)
token string Yes* Authentication token (*required if ssid not provided)
ssid string Yes* Session ID (*required if userId/token not provided)
empId number Yes Employee ID to update
name string No Employee's full name
email string No Employee's email address (must be unique)
mobile number No Employee's mobile number
address string No Employee's address
destination object No Destination configuration for call routing
destination.type string No Destination type (e.g., "MOBILE", "SIP", "LANDLINE")
destination.value string No Destination value (phone number or endpoint)
role number No Employee's role ID (must exist in system)
type string No Employee type (e.g., "Both", "Inbound", "Outbound")
parent string No Parent employee ID or "root"
callpwd string No Call password (minimum 6 digits)
working object No Working hours configuration by day
working.[DAY] array No Array of time slots for each day (MON, TUE, WED, THU, FRI, SAT, SUN)
working.[DAY][].from number No Start time in minutes from midnight (0-1439)
working.[DAY][].to number No End time in minutes from midnight (0-1439)
group object No Group assignments (key: group ID, value: "Y" or "N")
status number No Employee status (0 = inactive, 1 = active)
preDelete string No Pre-delete status for restoration (used internally)
forward boolean No Skip permission check if true (default: false)

Request Example

With Token and UserId - Full Update

{
  "userId": "{{userid}}",
  "token": "{{token}}",
  "empId": X,
  "name": "XXXX XXXXX",
  "mobile": 91XXXXXXXXXX,
  "email": "xxxx.xxxx@example.com",
  "address": "XXXXXXX",
  "destination": {
    "type": "MOBILE",
    "value": "XXXXXXXXXX"
  },
  "role": X,
  "type": "Both",
  "parent": "root",
  "callpwd": "XXXXXXXX",
  "working": {
    "MON": [
      {
        "from": 0,
        "to": 1137
      },
      {
        "from": 1139,
        "to": 1239
      },
      {
        "from": 1339,
        "to": 1439
      }
    ]
  },
  "group": {
    "{{groupid}}": "Y"
  },
  "status": 1
}

Partial Update - Status Only

{
  "userId": "{{userid}}",
  "token": "{{token}}",
  "empId": X,
  "status": 0
}

Partial Update - Name and Email

{
  "ssid": "{{ssid}}",
  "empId": X,
  "name": "XXXX XXXXX",
  "email": "xxxx@example.com"
}

Working Hours Format

Working hours are specified in minutes from midnight (0-1439):

Example:

{
  "MON": [
    { "from": 540, "to": 1080 } // 9:00 AM to 6:00 PM
  ],
  "TUE": [{ "from": 540, "to": 1080 }]
}

Multiple time slots per day:

{
  "MON": [
    { "from": 0, "to": 1137 }, // 12:00 AM to 6:57 PM
    { "from": 1139, "to": 1239 }, // 6:59 PM to 8:39 PM
    { "from": 1339, "to": 1439 } // 10:19 PM to 11:59 PM
  ]
}

Response Details

Success Response

Status Code: 200

{
  "status": "success",
  "code": 200,
  "message": "Your data successfully updated"
}
Field Type Description
status string Response status ("success" or "error")
code number Response code (200 for success)
message string Success message

Error Response Examples

Error 1: Invalid Group Data

Status Code: 200

{
  "status": "error",
  "message": "invalid group data ",
  "code": 1505
}

Error 2: Invalid Employee

Status Code: 200

{
  "status": "error",
  "message": "invalid employee",
  "code": 1509
}

Error 3: Email Already Exists

Status Code: 200

{
  "status": "error",
  "message": "email is alreday exists",
  "code": 1512
}

Error 4: Invalid Role ID

Status Code: 200

{
  "status": "error",
  "message": "invalid role id",
  "code": 1503
}

Error 5: Invalid Status Value

Status Code: 200

{
  "status": "error",
  "message": "invalid status value",
  "code": 1508
}

Error 6: Employee Limit Reached (when activating)

Status Code: 200

{
  "status": "error",
  "message": "The limit for creating or activating employees has been reached, so you cannot create or activate a new employee now.",
  "code": 1532
}

Error Codes

Error Code Description
1000 Invalid parameters
1047 Invalid request (empty body)
1503 Invalid role id
1504 Invalid parent
1505 Invalid group data
1506 Employee and parent could not be same
1508 Invalid status value
1509 Invalid employee (not found or unauthorized)
1510 Invalid destination
1511 Working time format is invalid
1512 Email already exists
1513 Invalid type
1514 Invalid mobile number
1515 Invalid name
1519 Call password must be minimum 6 digits
1521 Please provide only valid fields
1532 Employee limit reached (when activating)
1534 PreDelete value exceeds limit of 2

Notes

Example cURL Request

Full Update

curl -X POST "{{domain}}/api/v2/Employee/update" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "{{userid}}",
    "token": "{{token}}",
    "empId": X,
    "name": "XXXX XXXXX",
    "email": "xxxx@example.com",
    "status": 1
  }'

Status Update Only

curl -X POST "{{domain}}/api/v2/Employee/update" \
  -H "Content-Type: application/json" \
  -d '{
    "ssid": "{{ssid}}",
    "empId": X,
    "status": 0
  }'

Validation Process

The API performs the following validations in order:

  1. Request Validation

    • Checks if request body is not empty
    • Validates API request format
  2. Authentication Validation

    • Validates SSID or userId/token combination
    • Checks if session is valid
  3. Permission Check

    • Verifies EDIT_EMPLOYEES permission (unless forward=true)
  4. Employee Existence Check

    • Validates empId is provided
    • Checks if employee exists in the system
    • Verifies employee belongs to the requesting user
  5. Employee Limit Check (if activating)

    • If status is being changed to 1 (active) and preDelete > 0:
      • Checks if preDelete > 2 (returns error 1534)
      • Checks if current employee count >= limit (returns error 1532)
  6. Field Validation (for provided fields only)

    • Name: Must be valid and not empty
    • Email: Must be unique and valid format
    • Mobile: Must be valid phone number
    • Role: Must exist in user's role list
    • Working hours: Must be in valid range (0-1439)
    • Destination: Must have valid type and value
    • Call password: Must be minimum 6 digits
    • Groups: All group IDs must exist
    • Status: Must be 0 or 1
    • Parent: Must exist or be valid value
  7. Change Detection

    • Compares before/after data
    • Identifies what changed (status, groups, profile, working hours)
    • Logs changes to audit system
  8. Data Update

    • Updates employee record in database
    • Updates group assignments if changed
    • Updates working hours if changed
    • Updates search indexes
    • Triggers status change events if applicable
  9. Side Effects (based on changes)

    • Status change to 0 (inactive):
      • Removes from active employee mappings
      • Unassigns WhatsApp numbers
      • Triggers campaign rollback
    • Email change:
      • Sends update notification email (if enabled)
    • Role change:
      • Updates permission cache

Update Behavior

Status Updates

Group Updates

Best Practices

  1. Use partial updates - Only send fields that need to change
  2. Validate employee existence before attempting updates
  3. Check employee limits before activating inactive employees
  4. Use status field carefully - Status changes have significant side effects
  5. Provide complete working hours when updating schedules
  6. Verify email uniqueness before updating
  7. Test with single employee before bulk updates
  8. Monitor change logs for audit trail
  9. Handle errors gracefully - API continues even if some validations fail
  10. Use empId consistently - Ensure you're updating the correct employee

Update

var axios = require('axios');
var data = '{"userId":"{{userid}}","token":"{{token}}","NAme": "Manoj Kumar111","mobile": 9887613096,"email": "manoj.rao1@snet.in","address": "address ","destination": {"type": "MOBILE","value": "9887613096"},"role": 1,"type": "Both","parent": "root","callpwd": "98765432","working": {"MON": [{"from": 0,"to": 1137},{"from": 1139,"to": 1239},{"from": 1339,"to": 1439}]},"group": {"33": "Y"},"empId": 7,"status": 0}';

var config = {
 method: 'post',
 url: '{{brand}}/api/v2/Employee/update',
 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/Employee/update');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
 'follow_redirects' => TRUE
));
$request->setHeader(array(
 'Content-Length' => ''
));
$request->setBody('{"userId":"{{userid}}","token":"{{token}}","NAme": "Manoj Kumar111","mobile": 9887613096,"email": "manoj.rao1@snet.in","address": "address ","destination": {"type": "MOBILE","value": "9887613096"},"role": 1,"type": "Both","parent": "root","callpwd": "98765432","working": {"MON": [{"from": 0,"to": 1137},{"from": 1139,"to": 1239},{"from": 1339,"to": 1439}]},"group": {"33": "Y"},"empId": 7,"status": 0}');
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}}\",\"NAme\": \"Manoj Kumar111\",\"mobile\": 9887613096,\"email\": \"manoj.rao1@snet.in\",\"address\": \"address \",\"destination\": {\"type\": \"MOBILE\",\"value\": \"9887613096\"},\"role\": 1,\"type\": \"Both\",\"parent\": \"root\",\"callpwd\": \"98765432\",\"working\": {\"MON\": [{\"from\": 0,\"to\": 1137},{\"from\": 1139,\"to\": 1239},{\"from\": 1339,\"to\": 1439}]},\"group\": {\"33\": \"Y\"},\"empId\": 7,\"status\": 0}"
headers = {
 'Content-Length': ''
}
conn.request("POST", "/api/v2/Employee/update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/Employee/update");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{" + "\n" +
@"    ""userId"":""{{userid}}""," + "\n" +
@"    ""token"":""{{token}}""," + "\n" +
@"    ""NAme"": ""Manoj Kumar111""," + "\n" +
@"    ""mobile"": 9887613096," + "\n" +
@"    ""email"": ""manoj.rao1@snet.in""," + "\n" +
@"    ""address"": ""address ""," + "\n" +
@"    ""destination"": {" + "\n" +
@"        ""type"": ""MOBILE""," + "\n" +
@"        ""value"": ""9887613096""" + "\n" +
@"    }," + "\n" +
@"    ""role"": 1," + "\n" +
@"    ""type"": ""Both""," + "\n" +
@"    ""parent"": ""root""," + "\n" +
@"    ""callpwd"": ""98765432""," + "\n" +
@"    ""working"": {" + "\n" +
@"        ""MON"": [" + "\n" +
@"            {" + "\n" +
@"                ""from"": 0," + "\n" +
@"                ""to"": 1137" + "\n" +
@"            }," + "\n" +
@"            {" + "\n" +
@"                ""from"": 1139," + "\n" +
@"                ""to"": 1239" + "\n" +
@"            }," + "\n" +
@"            {" + "\n" +
@"                ""from"": 1339," + "\n" +
@"                ""to"": 1439" + "\n" +
@"            }" + "\n" +
@"        ]" + "\n" +
@"    }," + "\n" +
@"    ""group"": {" + "\n" +
@"        ""33"": ""Y""" + "\n" +
@"    }," + "\n" +
@"    ""empId"": 7," + "\n" +
@"    ""status"": 0" + "\n" +
@"}" + "\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/Employee/update' \
--data-raw '{
    "userId":"{{userid}}",
    "token":"{{token}}",
    "NAme": "Manoj Kumar111",
    "mobile": 9887613096,
    "email": "manoj.rao1@snet.in",
    "address": "address ",
    "destination": {
        "type": "MOBILE",
        "value": "9887613096"
    },
    "role": 1,
    "type": "Both",
    "parent": "root",
    "callpwd": "98765432",
    "working": {
        "MON": [
            {
                "from": 0,
                "to": 1137
            },
            {
                "from": 1139,
                "to": 1239
            },
            {
                "from": 1339,
                "to": 1439
            }
        ]
    },
    "group": {
        "33": "Y"
    },
    "empId": 7,
    "status": 0
}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/Employee/update'));
request.body = '''{\n    "userId":"{{userid}}",\n    "token":"{{token}}",\n    "NAme": "Manoj Kumar111",\n    "mobile": 9887613096,\n    "email": "manoj.rao1@snet.in",\n    "address": "address ",\n    "destination": {\n        "type": "MOBILE",\n        "value": "9887613096"\n    },\n    "role": 1,\n    "type": "Both",\n    "parent": "root",\n    "callpwd": "98765432",\n    "working": {\n        "MON": [\n            {\n                "from": 0,\n                "to": 1137\n            },\n            {\n                "from": 1139,\n                "to": 1239\n            },\n            {\n                "from": 1339,\n                "to": 1439\n            }\n        ]\n    },\n    "group": {\n        "33": "Y"\n    },\n    "empId": 7,\n    "status": 0\n}\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/Employee/update"
   method := "POST"

   payload := strings.NewReader(`{
    "userId":"{{userid}}",
    "token":"{{token}}",
    "NAme": "Manoj Kumar111",
    "mobile": 9887613096,
    "email": "manoj.rao1@snet.in",
    "address": "address ",
    "destination": {
        "type": "MOBILE",
        "value": "9887613096"
    },
    "role": 1,
    "type": "Both",
    "parent": "root",
    "callpwd": "98765432",
    "working": {
        "MON": [
            {
                "from": 0,
                "to": 1137
            },
            {
                "from": 1139,
                "to": 1239
            },
            {
                "from": 1339,
                "to": 1439
            }
        ]
    },
    "group": {
        "33": "Y"
    },
    "empId": 7,
    "status": 0
}`)

   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/Employee/update HTTP/1.1
Host: {{brand}}
Content-Length: 718

{
    "userId":"{{userid}}",
    "token":"{{token}}",
    "NAme": "Manoj Kumar111",
    "mobile": 9887613096,
    "email": "manoj.rao1@snet.in",
    "address": "address ",
    "destination": {
        "type": "MOBILE",
        "value": "9887613096"
    },
    "role": 1,
    "type": "Both",
    "parent": "root",
    "callpwd": "98765432",
    "working": {
        "MON": [
            {
                "from": 0,
                "to": 1137
            },
            {
                "from": 1139,
                "to": 1239
            },
            {
                "from": 1339,
                "to": 1439
            }
        ]
    },
    "group": {
        "33": "Y"
    },
    "empId": 7,
    "status": 0
}
OkHttpClient client = new OkHttpClient().newBuilder()
   .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n    \"userId\":\"{{userid}}\",\n    \"token\":\"{{token}}\",\n    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}\n");
Request request = new Request.Builder()
   .url("{{brand}}/api/v2/Employee/update")
   .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    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}\n";

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

fetch("{{brand}}/api/v2/Employee/update", 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/Employee/update");
   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    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}\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/Employee/update"]
   cachePolicy:NSURLRequestUseProtocolCachePolicy
   timeoutInterval:10.0];
NSDictionary *headers = @{
   @"Content-Length": @""
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n    \"userId\":\"{{userid}}\",\n    \"token\":\"{{token}}\",\n    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}\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    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}";;

let reqBody = 
   let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/Employee/update" 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    `"NAme`": `"Manoj Kumar111`",`n    `"mobile`": 9887613096,`n    `"email`": `"manoj.rao1@snet.in`",`n    `"address`": `"address `",`n    `"destination`": {`n        `"type`": `"MOBILE`",`n        `"value`": `"9887613096`"`n    },`n    `"role`": 1,`n    `"type`": `"Both`",`n    `"parent`": `"root`",`n    `"callpwd`": `"98765432`",`n    `"working`": {`n        `"MON`": [`n            {`n                `"from`": 0,`n                `"to`": 1137`n            },`n            {`n                `"from`": 1139,`n                `"to`": 1239`n            },`n            {`n                `"from`": 1339,`n                `"to`": 1439`n            }`n        ]`n    },`n    `"group`": {`n        `"33`": `"Y`"`n    },`n    `"empId`": 7,`n    `"status`": 0`n}`n"

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

url = URI("{{brand}}/api/v2/Employee/update")

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    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}"

response = http.request(request)
puts response.read_body
printf '{
    "userId":"{{userid}}",
    "token":"{{token}}",
    "NAme": "Manoj Kumar111",
    "mobile": 9887613096,
    "email": "manoj.rao1@snet.in",
    "address": "address ",
    "destination": {
        "type": "MOBILE",
        "value": "9887613096"
    },
    "role": 1,
    "type": "Both",
    "parent": "root",
    "callpwd": "98765432",
    "working": {
        "MON": [
            {
                "from": 0,
                "to": 1137
            },
            {
                "from": 1139,
                "to": 1239
            },
            {
                "from": 1339,
                "to": 1439
            }
        ]
    },
    "group": {
        "33": "Y"
    },
    "empId": 7,
    "status": 0
}
'| http  --follow --timeout 3600 POST '{{brand}}/api/v2/Employee/update' \
 Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

let parameters = "{\n    \"userId\":\"{{userid}}\",\n    \"token\":\"{{token}}\",\n    \"NAme\": \"Manoj Kumar111\",\n    \"mobile\": 9887613096,\n    \"email\": \"manoj.rao1@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 1,\n    \"type\": \"Both\",\n    \"parent\": \"root\",\n    \"callpwd\": \"98765432\",\n    \"working\": {\n        \"MON\": [\n            {\n                \"from\": 0,\n                \"to\": 1137\n            },\n            {\n                \"from\": 1139,\n                \"to\": 1239\n            },\n            {\n                \"from\": 1339,\n                \"to\": 1439\n            }\n        ]\n    },\n    \"group\": {\n        \"33\": \"Y\"\n    },\n    \"empId\": 7,\n    \"status\": 0\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{brand}}/api/v2/Employee/update")!,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
 15 Nov 2025 11:43:44 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"62"}
{"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\/\"3e-9h9d5trMB2ccbRDt0FLYLi8dNSo\""}
{"key":"Strict-Transport-Security"
"value":"max-age=15724800; includeSubDomains"}
{"key":"Access-Control-Max-Age"
"value":"1728000"}]
 {
    "status": "error",
    "message": "invalid group data ",
    "code": 1505
}