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.

Create

{{brand}}/api/v2/Employee/Create

Introduction

This document provides detailed information about the Employee Create 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.


Create Employee

Endpoint

Description

The Create Employee endpoint allows you to add a new employee to the system. This endpoint validates all input data, checks employee limits, and creates the employee with proper group assignments and working hours.

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)
name string Yes Employee's full name
email string Yes Employee's email address (must be unique)
mobile number Yes Employee's mobile number
address string No Employee's address
destination object Yes Destination configuration for call routing
destination.type string Yes Destination type (e.g., "MOBILE", "SIP", "LANDLINE")
destination.value string Yes Destination value (phone number or endpoint)
role number Yes Employee's role ID (must exist in system)
type string Yes Employee type (e.g., "Both", "Inbound", "Outbound")
parent string No Parent employee ID or "root" (default: "root")
callpwd string No 8-digit call password (auto-generated if not provided)
working object Yes Working hours configuration by day
working.[DAY] array Yes Array of time slots for each day (MON, TUE, WED, THU, FRI, SAT, SUN)
working.[DAY][].from number Yes Start time in minutes from midnight (0-1439)
working.[DAY][].to number Yes End time in minutes from midnight (0-1439)
group object No Group assignments (key: group ID, value: "Y" or "N")
forward boolean No Skip permission check if true (default: false)

Request Example

With Token and UserId

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

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 inserted.",
  "empId": XXX
}
Field Type Description
status string Response status ("success" or "error")
code number Response code (200 for success)
message string Success message
empId number Newly created employee ID

Error Response Examples

Error 1: Email Already Exists

Status Code: 200

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

Error 2: Invalid Fields Provided

Status Code: 200

{
  "status": "error",
  "message": "Please Provide Only Valid fields",
  "code": 1521
}

Error 3: Invalid Role ID

Status Code: 200

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

Error 4: Employee Limit Reached

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
1509 Invalid employee
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 integer and eight digit
1521 Please provide only valid fields
1522 Data could not be inserted
1532 Employee limit reached

Notes

Example cURL Request

curl -X POST "{{domain}}/api/v2/Employee/create" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "{{userid}}",
    "token": "{{token}}",
    "name": "XXXX XXXXX",
    "mobile": 91XXXXXXXXXX,
    "email": "xxxx@example.com",
    "destination": {
      "type": "MOBILE",
      "value": "XXXXXXXXXX"
    },
    "role": XX,
    "type": "Both",
    "working": {
      "MON": [{"from": 540, "to": 1080}]
    }
  }'

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 ADD_EMPLOYEE permission (unless forward=true)
  4. Employee Limit Check

    • Validates current employee count against account limit
  5. Field Validation

    • Name: Must be provided and valid
    • 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 8 digits (if provided)
    • Groups: All group IDs must exist
  6. Data Creation

    • Creates employee record in database
    • Assigns groups
    • Sets up working hours
    • Updates search indexes

Best Practices

  1. Always provide working hours for all operational days
  2. Use valid email addresses to avoid duplicate errors
  3. Check employee limits before bulk employee creation
  4. Provide 8-digit call passwords or let system auto-generate
  5. Use proper destination types matching your telephony setup
  6. Assign appropriate roles based on employee responsibilities
  7. Set realistic working hours matching business operations

Create

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

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

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

   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/Create HTTP/1.1
Host: {{brand}}
Content-Length: 685

{
    "userId":"{{userid}}",
    "token":"{{token}}",
    "NAme": "Manoj Kumar111",
    "mobile": 9887613096,
    "email": "manoj.rao@snet.in",
    "address": "address ",
    "destination": {
        "type": "MOBILE",
        "value": "9887613096"
    },
    "role": 12,
    "type": "Both",
    "parent": "root",
    "callpwd": "98765432",
    "working": {
        "MON": [
            {
                "from": 0,
                "to": 1137
            },
            {
                "from": 1139,
                "to": 1239
            },
            {
                "from": 1339,
                "to": 1439
            }
        ]
    },
    "group": {
        "90": "Y"
    }
}
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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\n    }\n}");
Request request = new Request.Builder()
   .url("{{brand}}/api/v2/Employee/Create")
   .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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\n    }\n}";

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

fetch("{{brand}}/api/v2/Employee/Create", 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/Create");
   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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\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/Create"]
   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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\n    }\n}";;

let reqBody = 
   let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/Employee/Create" 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.rao@snet.in`",`n    `"address`": `"address `",`n    `"destination`": {`n        `"type`": `"MOBILE`",`n        `"value`": `"9887613096`"`n    },`n    `"role`": 12,`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        `"90`": `"Y`"`n    }`n}"

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

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

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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\n    }\n}"

response = http.request(request)
puts response.read_body
printf '{
    "userId":"{{userid}}",
    "token":"{{token}}",
    "NAme": "Manoj Kumar111",
    "mobile": 9887613096,
    "email": "manoj.rao@snet.in",
    "address": "address ",
    "destination": {
        "type": "MOBILE",
        "value": "9887613096"
    },
    "role": 12,
    "type": "Both",
    "parent": "root",
    "callpwd": "98765432",
    "working": {
        "MON": [
            {
                "from": 0,
                "to": 1137
            },
            {
                "from": 1139,
                "to": 1239
            },
            {
                "from": 1339,
                "to": 1439
            }
        ]
    },
    "group": {
        "90": "Y"
    }
}'| http  --follow --timeout 3600 POST '{{brand}}/api/v2/Employee/Create' \
 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.rao@snet.in\",\n    \"address\": \"address \",\n    \"destination\": {\n        \"type\": \"MOBILE\",\n        \"value\": \"9887613096\"\n    },\n    \"role\": 12,\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        \"90\": \"Y\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{brand}}/api/v2/Employee/Create")!,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 10:35:26 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"66"}
{"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\/\"42-ywKqgMfSLHm4KGtYFEAdDx9V5ik\""}
{"key":"Strict-Transport-Security"
"value":"max-age=15724800; includeSubDomains"}
{"key":"Access-Control-Max-Age"
"value":"1728000"}]
 {
    "status": "error",
    "message": "email is alreday exists",
    "code": 1512
}