Insert Record API for Adding Employees

Employees can be added to the Organisation using Insert Record API itself. Employee addition to the Organisation can be done in two ways in Zoho People. 

  1. Employee can be invited to join the Organisation through Invitation.
  2. If the Organisation have the domain verified in Zoho People, then users can be added directly to the organisation with email id as the user name and a initial password. 

Request URL:

https://people.zoho.com/people/api/forms/json/employee/insertRecord

Header:

Authorization:Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf

Scope:

scope = ZOHOPEOPLE.forms.CREATE 

For standalone Zoho People only, not applicable when Zoho People is part of Zoho One, People Plus, or any other bundle.

ParameterDescription and ValueMandatory / Optional
input dataInput data for employee record in JSON format. Mandatory (For Employee addition, “EmployeeID”, “FirstName”, “LastName”, “EmailID” are mandatory)
isNonUsertrue or false. If true is sent, the user will be added as an employee profile in the system.Optional
isDirectAddtrue or false. If true is sent, the user will be added as an employee with active status  in the system.Optional
passwordany valid passwordMandatory if isDirectAdd is true
  1. If isDirectAdd parameter is not sent in the request, an employee record will be created with status as inactive and an invitation will be sent.
  2. If isNonUser parameter is not sent in the request, by default the user will be added as an employee in the system. 

Example 1 (Without isNonUser and isDirectAdd Parameter)

Example 2 (Without isNonUser and with isDirectAdd)

Example 3 (With isNonUser parameter)

Threshold Limit: 300 requests | Lock period: 5 minutes

Threshold Limit - Number of API calls allowed within a minute.
Lock Period - Wait time before consecutive API requests.

Example 1 (Without isNonUser and isDirectAdd Parameter) - Sample Request

CopiedinputData={"EmployeeID":"HRM02","FirstName":"John","LastName":"Doe","EmailID"
:"johndoe@example.com"}

Sample Response

Copied{
   "response": {
       "result": {
           "pkId": "759415000001352001",
           "message": "Successfully Added"
       },
       "message": "Data added successfully",
       "uri": "/api/forms/json/employee/insertRecord",
       "status": 0
   }
}
CopiedOkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "inputData={\"EmployeeID\":\"HRM02\",\"FirstName\":\"John\",\"LastName\":\"Doe\",\"EmailID\":\"johndoe@example.com\"}");
Request request = new Request.Builder()
  .url("https://people.zoho.com/api/forms/json/employee/insertRecord")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("Authorization", "••••••")
  .addHeader("Cookie", "CSRF_TOKEN=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zcsr_tmp=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zpsid=AE36133351D796F9DD92F5F12C6073A4; zalb_c7cb34e6ac=260d8f5aac79c6a7b715e8dbb7eadf99")
  .build();
Response response = client.newCall(request).execute();
Copiedcurl --location 'https://people.zoho.com/api/forms/json/employee/insertRecord' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: ••••••' \
--header 'Cookie: CSRF_TOKEN=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zcsr_tmp=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zpsid=AE36133351D796F9DD92F5F12C6073A4; zalb_c7cb34e6ac=260d8f5aac79c6a7b715e8dbb7eadf99' \
--data-urlencode 'inputData={"EmployeeID":"HRM02","FirstName":"John","LastName":"Doe","EmailID":"johndoe@example.com"}'
Copiedconst myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Authorization", "••••••");
myHeaders.append("Cookie", "CSRF_TOKEN=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zcsr_tmp=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zpsid=AE36133351D796F9DD92F5F12C6073A4; zalb_c7cb34e6ac=260d8f5aac79c6a7b715e8dbb7eadf99");

const urlencoded = new URLSearchParams();
urlencoded.append("inputData", "{\"EmployeeID\":\"HRM02\",\"FirstName\":\"John\",\"LastName\":\"Doe\",\"EmailID\":\"johndoe@example.com\"}");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: urlencoded,
  redirect: "follow"
};

fetch("https://people.zoho.com/api/forms/json/employee/insertRecord", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
 .catch((error) => console.error(error));
CopiedinputMap = Map();
inputMap.put("inputData","{'EmployeeID':'HRM02','FirstName':'John','LastName':'Doe','EmailID':'johndoe@example.com'}");
AuthMap = Collection();
AuthMap.insert("Authorization":"••••••");

response = invokeUrl
[
 	url: "https://people.zoho.com/api/forms/json/employee/insertRecord"
 	type: POST
 	parameters: inputMap
 	headers: AuthMap.toMap()
];
info response;
Copiedimport requests

url = "https://people.zoho.com/api/forms/json/employee/insertRecord"

payload = 'inputData=%7B%22EmployeeID%22%3A%22HRM02%22%2C%22FirstName%22%3A%22John%22%2C%22LastName%22%3A%22Doe%22%2C%22EmailID%22%3A%22johndoe%40example.com%22%7D'
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': '••••••',
  'Cookie': 'CSRF_TOKEN=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zcsr_tmp=c9dfa56e-13d1-401d-b2c8-0f9a7b59095b; _zpsid=AE36133351D796F9DD92F5F12C6073A4; zalb_c7cb34e6ac=260d8f5aac79c6a7b715e8dbb7eadf99'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Example 2 (Without isNonUser and with isDirectAdd) - Sample Request

CopiedinputData={"EmployeeID":"HRM02","FirstName":"John","LastName":"Doe","EmailID":"johndoe@example.com"}

Sample Response:

Copied{
   "response": {
       "result": {
           "pkId": "759415000001352001",
           "message": "Successfully Added"
       },
       "message": "Data added successfully",
       "uri": "/api/forms/json/employee/insertRecord",
       "status": 0
   }
}

Example 3 (With isNonUser parameter) - Sample Request

CopiedinputData={"EmployeeID":"HRM02","FirstName":"John","LastName":"Doe",
"EmailID":"johndoe@example.com"}
isNonUser=true

Sample Response:

Copied{
   "response": {
       "result": {
           "pkId": "759415000001352001",
           "message": "Successfully Added"
       },
       "message": "Data added successfully",
       "uri": "/api/forms/json/employee/insertRecord",
       "status": 0
   }
}