People API

API List

Zoho People and Forms

As you know, Zoho People is a simple online HRIS tool designed to manage and access all your employee data. In order to manage the employee database, forms are being used, which is an important entity of Zoho People. Forms consists of sections and tabular sections which is a collection of fields. For easy accessibility, we have provided pre-defined forms like Employee, Department, Designation etc., If you would like to have your own forms, you can create custom forms to build a new module.

Note:

    To get response in XML format you need to set HttpHeader "Accept" as "application/xml" and for JSON set HttpHeader "Accept" as "application/json"

API Methods

Record Count API

To know the total record counts of an employee form, use the API below.

URL:

https://people.zoho.com/people/api/employee/counts?authtoken=<token>

To pull up the employee records by month & year, specify the value accordingly as given in the below example URL.

https://people.zoho.com/people/api/employee/counts?authtoken=<token>&month=2&year=2013

Parameter Description

authtoken Specify the authentication token
month Specify the month
year Specify the year

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response status=1><Count>1752</Count></Response>

JSON Format:

[{"Count":1752}]

Fetch Forms API

To know the list of forms and its details available in your Zoho People account, use the API below.

URL:

https://people.zoho.com/people/api/forms?authtoken=<token>

Parameter Description

authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<Forms>
<Form>
<isVisible>true</isVisible>
<displayName>Employee</displayName>
<componentId>6000000015673</componentId>
<iscustom>false</iscustom>
<formLinkName>P_Employee</formLinkName>
</Form>
<Form>
<isVisible>true</isVisible>
<displayName>Department</displayName>
<componentId>6000000015675</componentId>
<iscustom>false</iscustom>
<formLinkName>P_Department</formLinkName>
</Form>
<Form>
<isVisible>true</isVisible>
<displayName>Designation</displayName>
<componentId>6000000015677</componentId>
<iscustom>false</iscustom>
<formLinkName>P_Designation</formLinkName>
</Form>
<Form>
<isVisible>true</isVisible>
<displayName>Company Policy</displayName>
<componentId>6000000015681</componentId>
<iscustom>false</iscustom>
<formLinkName>P_Policy</formLinkName>
</Form>
<Form>
<isVisible>true</isVisible>
<displayName>Leave</displayName>
<componentId>6000000015685</componentId>
<iscustom>false</iscustom>
<formLinkName>P_ApplyLeave</formLinkName>
</Form>
<Form>
<isVisible>true</isVisible>
<displayName>Holidays</displayName>
<componentId>6000000015689</componentId>
<iscustom>false</iscustom>
<formLinkName>P_Holidays</formLinkName>
</Form>
</Forms>
</Response>

AuthToken Generation

Please refer this link to learn more about API and 'AuthToken' generation.

JSON Format:

[{"Forms":{"Form":[{"isVisible":"true","displayName":"Employee","componentId":"6000000015673","iscustom":"false","formLinkName":"P_Employee"},{"isVisible":"true","displayName":"Department","componentId":"6000000015675","iscustom":"false","formLinkName":"P_Department"},{"isVisible":"true","displayName":"Designation","componentId":"6000000015677","iscustom":"false","formLinkName":"P_Designation"},{"isVisible":"true","displayName":"Company Policy","componentId":"6000000015681","iscustom":"false","formLinkName":"P_Policy"},{"isVisible":"true","displayName":"Leave","componentId":"6000000015685","iscustom":"false","formLinkName":"P_ApplyLeave"},{"isVisible":"true","displayName":"Holidays","componentId":"6000000015689","iscustom":"false","formLinkName":"P_Holidays"},{"isVisible":"true","displayName":"Leave Type","componentId":"6000000015693","iscustom":"false","formLinkName":"P_LeaveType"}]}}]

Fetch Components API

To know the details of the components available in a form, use the API below.

URL:

https://people.zoho.com/people/api/forms/<formLinkName>/components?authtoken=<token>

Parameter Description

formLinkName To get formLinkName,use fetch forms API
authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<Components>
<Component>
<labelname>Department</labelname>
<ismandatory>true</ismandatory>
<ishidden>false</ishidden>
<comptype>1</comptype>
<displayname>Department Name</displayname>
</Component>
<Component>
<labelname>MailAlias</labelname>
<ismandatory>true</ismandatory>
<ishidden>false</ishidden>
<comptype>4</comptype>
<displayname>Mail Alias</displayname>
</Component>
<Component>
<labelname>Department_Lead</labelname>
<ismandatory>false</ismandatory>
<ishidden>false</ishidden>
<comptype>26</comptype>
<displayname>Department Lead</displayname>
</Component>
<Component>
<labelname>Parent_Department</labelname>
<ismandatory>false</ismandatory>
<ishidden>false</ishidden>
<comptype>26</comptype>
<displayname>Parent Department</displayname>
</Component>
<Component>
<labelname>testing</labelname>
<ismandatory>true</ismandatory>
<ishidden>false</ishidden>
<comptype>1</comptype>
<displayname>testing </displayname>
</Component>
</Components>
</Response>

JSON Format:

[{"labelname":"Department","ismandatory":"true","ishidden":"false","comptype":"1","displayname":"Department Name"},{"labelname":"MailAlias","ismandatory":"true","ishidden":"false","comptype":"4","displayname":"Mail Alias"},{"labelname":"Department_Lead","ismandatory":"false","ishidden":"false","comptype":"26","displayname":"Department Lead"},{"labelname":"Parent_Department","ismandatory":"false","ishidden":"false","comptype":"26","displayname":"Parent Department"},{"labelname":"testing","ismandatory":"true","ishidden":"false","comptype":"1","displayname":"testing "}]

Views

Views are the grid collection of records. It will list various fields that are available in the views of a form.

Default & custom view

Every form has a default view which displays the original set of records(also called the master data). However, you can create a custom view to filter out the records based on the specified field level condition.

To know the list of views available for all forms, use the API below.

URL:

https://people.zoho.com/people/api/views?authtoken=<token>

Parameter Description

authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<Views>
<Form name="P_Employee">
<View>
<viewName>P_EmployeeView</viewName>
<displayName>Employee View</displayName>
<viewId>6000000015697</viewId>
</View>
<View>
<viewName>DowngradedEmployeeView</viewName>
<displayName>Disabled Employee View</displayName>
<viewId>6000000015783</viewId>
</View>
<View>
<viewName>EmployeeInactiveView</viewName>
<displayName>Inactive Employees View</displayName>
<viewId>6000000015785</viewId>
</View>
<View>
<viewName>simple_view</viewName>
<displayName>simple view</displayName>
<viewId>6000000066025</viewId>
</View>
<View>
<viewName>new_view</viewName>
<displayName>new view</displayName>
<viewId>6000000075067</viewId>
</View>
<View>
<viewName>checking_view_order</viewName>
<displayName>checking view order</displayName>
<viewId>6000000239003</viewId>
</View>
</Form>
</Views>
</Response>

JSON Format:

[{"P_Employee":[{"viewName":"P_EmployeeView","displayName":"Employee View","viewId":"6000000015697"},{"viewName":"DowngradedEmployeeView","displayName":"Disabled Employee View","viewId":"6000000015783"},{"viewName":"EmployeeInactiveView","displayName":"Inactive Employees View","viewId":"6000000015785"},{"viewName":"P_Employee_ViewForAPI","displayName":"Api Employees View","viewId":"6000000015787"},{"viewName":"ok","displayName":"ok","viewId":"6000000040003"},{"viewName":"test","displayName":"test","viewId":"6000000041003"},{"viewName":"test","displayName":"test","viewId":"6000000041003"},{"viewName":"simple_view","displayName":"simple view","viewId":"6000000066025"},{"viewName":"simple_view","displayName":"simple view","viewId":"6000000066025"},{"viewName":"panch_user_vpersonal_view","displayName":"panch user vpersonal view","viewId":"6000000075003"},{"viewName":"new_view","displayName":"new view","viewId":"6000000075067"},{"viewName":"checking_view_order","displayName":"checking view order","viewId":"6000000239003"},{"viewName":"panchuuddd","displayName":"panchuuddd","viewId":"6000000436005"}]}, {"P_Department": [{"viewName":"P_DepartmentView","displayName":"Department View","viewId":"6000000015699"},{"viewName":"P_Department_ViewForAPI","displayName":"Api Department View","viewId":"6000000015789"},{"viewName":"test","displayName":"test","viewId":"6000000041003"}]},{"P_Designation":[{"viewName":"P_DesignationView","displayName":"Designation View","viewId":"6000000015701"},{"viewName":"P_Designation_ViewForAPI","displayName":"Api Designation View","viewId":"6000000015791"},{"viewName":"test","displayName":"test","viewId":"6000000041003"},{"viewName":"simple_view","displayName":"simple view","viewId":"6000000066025"}]}]

Fetch views of a specific form

To know the list of views available in a specific form, use the API below by specifying the 'formLinkName'.

URL:

https://people.zoho.com/people/api/forms/<formLinkName>/views?authtoken=<token>

Parameter Description

formLinkName To get the formlinkname, use the fetch form API.
authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<Views>
<View>
<viewName>P_DepartmentView</viewName>
<displayName>Department View</displayName>
<viewId>6000000015699</viewId>
</View>
<View>
<viewName>Support</viewName>
<displayName>Support</displayName>
<viewId>6000000041003</viewId>
</View>
</Views>
</Response>

JSON Format:

[{"viewName":"P_DepartmentView","displayName":"Department View","viewId":"6000000015699"},{"viewName":"Support","displayName":"Support","viewId":"6000000041003"}]

Record Level APIs

Add Record

To add a record of a form, use the API below

URL:

https://people.zoho.com/people/api/forms/<formLinkName>/records?authtoken=<token>&xmlData=<xmlData>

Note:

  • Use POST method to pass these parameters instead of GET method.

Parameter Description

xmlData sample input: <Request><Record><field name="Labelname"></field><field name="LabelName1"></field><field name="Labelname2"></field></Record></Request>
authtoken Specify the authentication token
formLinkName To get formlinkname,use the fetch form API.

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

Example URL:

https://people.zoho.com/people/api/forms/P_Employee/records?authtoken=7d985878998943g4j09h43dd0b167dda34b&xmlData=<Request><Record><field name='EmployeeID'>011</field><field name='FirstName'>steves</field><field name='LastName'>V</field><field name='EmailID'>steves@domain.com</field><field name='Marital_status'>Married</field></Record></Request>

XML Format:

<Response Status="1">
<message>Successfully Added</message>
</Response>

JSON Format:

[{"message":"Successfully Added","Response":1}]

We have provided default APIs for adding Employee, Department and Leave records. If you need specific APIs for other default forms, contact us at support@zohopeople.com.

Add Employee

To add an employee to your organization, use the below API and mention the keyword 'employee' in place of the 'formLinkName'.

URL:

https://people.zoho.com/people/api/employee/records?authtoken=<token>&xmlData=<xmlData>

Parameter Description

xmlData sample input: <Request><Record><field name="Labelname"></field><field name="LabelName1"></field><field name="Labelname2"></field></Record></Request>
authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

Example URL:

https://people.zoho.com/people/api/employee/records?authtoken=7d985878998943g4j09h43dd0b167dda34b &xmlData=<Request><Record><field name='EmployeeID'>011</field><field name='FirstName'>steves</field><field name='LastName'>V</field><field name='EmailID'>steves@domain.com</field><field name='Marital_status'>Married</field></Record></Request>

XML Format:

<Response Status="1">
<message>Successfully Added</message>
</Response>

JSON Format:

[{"message":"Successfully Added","Response":1}]

Favorite Employees API

Zoho People offers you an additional feature of keeping your favorite employees under favorites list for easy access.

Marking an employee as Favorite

The favorites list holds all your favorite employees' details. Just mark them as favorite and you can view them under the favorites list.

Note

  • Currently this option is not available in the Web UI, but we are working on this and will be available soon.

URL:

https://people.zoho.com/people/api/employee/records/<recordId>?favStatus=true&authtoken=<token>

Parameter Description

recordId Specify the user record ID of the record being added
authtoken Specify the authentication token
favStatus Specify true to tag an employee as favorite

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<message>Successfully added</message>
</Response>

JSON Format:

[{"message":"Successfully added","Response":1}]

Favorites List

It will fetch and list all your favorite employees' details like Erecno, Employee ID and Email ID.

URL:

https://people.zoho.com/people/api/employee/records/favorites?authtoken=<token>

Parameter Description

authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<Records>
<Record>
<Erecno>6000000026007</Erecno>
<EmployeeLastname>lokesh</EmployeeLastname>
<EmployeemailId>lokesh@zohosmtpin.india.adventnet.com</EmployeemailId>
<EmployeeFirstname>lokesh</EmployeeFirstname>
<Departmentname>Gadgets</Departmentname>
<ResidentialPhone>
</ResidentialPhone>
<workExtn>6543</workExtn>
<workPhone>3453</workPhone>
<mobile>9987898789</mobile>
<EmployeeId>4</EmployeeId>
</Record>
</Records>
</Response>

JSON Format:

[{"Erecno":6000000026007,"EmployeeLastname":"lokesh","EmployeemailId":"lokesh@domain.com","EmployeeFirstname":"lokesh","Departmentname":"Support","ResidentialPhone":"","workExtn":"6543","workPhone":"3453","mobile":"9987898789","EmployeeId":"4"}]

Unmark/Remove favorite employee

You can unmark/remove an employee from the favorites list any time, if you want to.

URL:

https://people.zoho.com/people/api/employee/records/<recordId>?favStatus=false?authtoken=<token>

Parameter Description

recordid Specify the user record ID of the record being added
authtoken Specify the authentication token
favStatus Specify false to unmark

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

XML Format:

<Response Status="1">
<message>Successfully removed</message>
</Response>

JSON Format:

[{"message":"Successfully removed","Response":1}]

Add Department

You can add various departments one by one in Zoho People using the API below.

URL:

https://people.zoho.com/people/api/department/records?authtoken=<token>&xmlData=<xmlData>

Parameter Description

xmlData sample input: <Request><Record><field name="Labelname"></field><field name="LabelName1"></field><field name="Labelname2"></field></Record></Request>
authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

Example URL

https://people.zoho.com/people/xml/addDepartment?authtoken=7d985878998943g4j09h43dd0b167dda34b &xmlData=<Request><Record><field name='Department'>support</field><field name='MailAlias'>sohail@domain.com</field><field name='Department_Lead'>17</field><field name='testing'>17</field></Record></Request>

XML Format:

<Response Status="1">
<message>Successfully Added</message>
</Response>

JSON Format:

[{"message":"Successfully Added","Response":1}]

Add Leave

You can add leave records using the API below and mention the keyword 'leave' in place of the 'formLinkName'.

URL:

https://people.zoho.com/people/api/leave/records?authtoken=<token>&xmlData=<xmlData>

Parameter Description

xmlData sample input: <Request><Record><field name="Labelname"></field><field name="LabelName1"></field><field name="Labelname2"></field></Record></Request>
authtoken Specify the authentication token

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Example URL

https://people.zoho.com/people/xml/addLeave?authtoken=7d985878998943g4j09h43dd0b167dda34b &xmlData=<Request><Record><field name='Employee_ID'>17</field><field name='To'>30-Jan-2013</field><field name='From'>30-Jan-2013</field><field name='Leavetype'>Vacation</field></Record></Request>

Response

XML Format:

<Response Status="1">
<message>Successfully Added</message>
</Response>

JSON Format:

[{"message":"Successfully Added","Response":1}]

Fetch Records API

This API will display the records of a form based on the 'view name' specified.

URL:

https://people.zoho.com/people/api/forms/<viewName>/records?authtoken=<token>

Parameter Description

authtoken Specify the authentication token
viewName To get the view name, use 'views' API.
sIndex Starting Index
rec_limit Number of records to be fetched

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Note:

  • If you want to customize the number of records to be shown on a page, specify the value for the parameters, "sIndex" & "rec_limit".

Example URL

https://people.zoho.com/people/api/forms/records?authtoken=<token>&sIndex=50&rec_limit=60

The above API will fetch records from 50 to 110.

Response

XML Format:

<Response Status="1">
<Records>
<Record>
<field name="recordId">6000000043063</field>
<field name="EmployeeID">17</field>
<field name="First Name">Mark</field>
<field name="Last Name">Charles</field>
<field name="Email ID">mcharles@domain.com</field>
<field name="Employee Role">Team member</field>
<field name="Reporting To"/>
<field name="Tags">tech support</field>
<field name="Employee Status">Active</field>
<field name="Status"></field>
</Record>
<Record>
<field name="recordId">6000000039075</field>
<field name="EmployeeID">14</field>
<field name="First Name">Micheal</field>
<field name="Last Name">Jerry</field>
<field name="Email ID">mike@domain.com</field>
<field name="Employee Role">Admin</field>
<field name="Reporting To">5 arun arun1</field>
<field name="Tags"/>
<field name="Employee Status">Active</field>
<field name="Status"/>
</Record>
</Records>
</Response>

JSON Format:

[{"EmployeeID":"17","recordId":6000000043063,"Status":"","Tags":"tech support","Employee Role":"Team member","Reporting To":"","Employee Status":"Active","Email ID":"Charles@domain.com","Last Name":"Charles","First Name":"Sujitha"}, {"EmployeeID":"14","recordId":6000000039075,"Status":"","Tags":"","Employee Role":"Admin","Reporting To":"5 arun arun1","Employee Status":"Active","Email ID":"mike@domain.com","Last Name":"Jerry","First Name":"Micheal"}]

Fetch Single Record

This API will display the record of a specific form indexed using a 'Record ID'.

URL:

https://people.zoho.com/people/api/forms/formLinkName>/records/<recordId>?authtoken=<token>&mode=fetchSingleRecord

Parameter Description

recordid Specifies the record ID of the record being fetched. The record ID can be identified using the fetch Records API.
Authtoken Specify the authentication token
formLinkName To get formlinkname, you can use fetchFormdetails API.

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

URL:

https://people.zoho.com/people/api/forms/employee/6000000043063?authtoken=7d985878998943g4j09h43dd0b167dda34b

XML Format:

<Response Status="1">
<tabularSections>
<section name="Dependent">
<row count="0">
<field name="Name">
</field>
<field name="DependentDOB">
</field>
<field name="DependentRelationship">
</field>
</row>
</section>
<section name="Education">
<row count="0">
<field name="Yearofgraduation">
</field>
<field name="Education_AdditionalNotes">&nbsp;</field>
<field name="Degree">
</field>
<field name="Specialization">
</field>
<field name="Interests"></field>
<field name="College">
</field>
</row>
</section>
<section name="Work experience">
<row count="0">
<field name="Todate">
</field>
<field name="Previous_JobDesc"></field>
<field name="FromDate">
</field>
<field name="Employer">
</field>
<field name="Jobtitle">
</field>
</row>
</section>
</tabularSections>
<section name="Summary">
<field name="Gender">Female</field>
<field name="Current_Job_Description">
</field>
<field name="Bloodgroup">AB -ve</field>
<field name="Expertise">
</field>
<field name="AboutMe"></field>
</section>
<section name="Personal">
<field name="Tags"></field>
<field name="Date_of_birth">07-Feb-1985</field>
<field name="Marital_status">Single</field>
<field name="Address">
</field>
<field name="Other_Email">
</field>
<field name="Mobile">99405233220</field>
</section>
<section name="Basic Info">
<field name="TestingN1">fdfdf</field>
<field name="Location_Awareness">In</field>
<field name="LastName">Charles</field>
<field name="Current_Location">CHENNAI</field>
<field name="Nick_Name">EERRRRRRRRRR</field>
<field name="EmployeeID">9902e3</field>
<field name="FirstName">Mark</field>
<field name="EmailID">mcharles@domain.com</field>
</section>
<section name="Work">
<field name="Extension">
</field>
<field name="Work_location">8EH34</field>
<field name="Work_phone">
</field>
<field name="Role">Admin</field>
<field name="Employee_type">Permanent</field>
<field name="Dateofjoining">11-Sep-2011</field>
<field name="Department">people</field>
<field name="Employeestatus">Active</field>
<field name="Designation">ET</field>
<field name="Reporting_To">arun arun1 5</field>
</section>
</Response>

JSON Format:

[{"tabularSections":{"Dependent":[{"Name":"","DependentDOB":"","DependentRelationship":""}],"Education":[{"Yearofgraduation":"","Education_AdditionalNotes":" ","Degree":"","Specialization":"","Interests":" ","College":""}],"Work experience":[{"Todate":"","Previous_JobDesc":" ","FromDate":"","Employer":"","Jobtitle":""}]},"Summary":{"Gender":"Female","Current_Job_Description":"","Bloodgroup":"AB -ve","Expertise":"","AboutMe":""},"Personal":{"Tags":"","Date_of_birth":"07-Feb-1985","Marital_status":"Single","Address":"","Other_Email":"","Mobile":"99405233220"},"Basic Info":{"TestingN1":"Test field","Location_Awareness":"In","LastName":"Charles","Current_Location":"CHENNAI","Nick_Name":"mark","EmployeeID":"902","FirstName":"Mark","EmailID":"mcharles@domain.com"},"Work":{"Extension":"","Work_location":"8EH34","Work_phone":"","Role":"Admin","Employee_type":"Permanent","Dateofjoining":"11-Sep-2011","Department":"people","Employeestatus":"Active","Designation":"ET","Reporting_To":"arun arun1 5"}}]

Update Record API

This API is used for modifying the field values of the specified record. i.e., you can edit the data of a record.

URL:

https://people.zoho.com/people/api/forms/<formLinkName>/records/<recordId>?mode=updateRecord&authtoken=<token>&xmlData=<xmlData>

Parameter Description

recordId Specifies the user record ID of the record being edited
xmlData sample input: <Request><Record><field name="Labelname"></field><field name="LabelName1"></field><field name="Labelname2"></field></Record></Request>
authtoken Specify the authentication token
formLinkName To get formlinkname, use the fetchFormdetails API

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Response

Sample URL:

https://people.zoho.com/people/api/forms/employee/records/6000000043063?authtoken=7d985878998943g4j09h43dd0b167dda34b&xmlData=<Request><Record><field name='Tags'>support</field></Record></Request>

XML Format:

<Response Status="1">
<message>Successfully Updated</message>
</Response>

JSON Format:

[{"message":"Successfully Updated","Response":1}]

Attendance Check-in & Check-out API

This API can be used to map the user ID of your employees. You can integrate this API with the attendance terminals in your organization to map the user ID of employees. The system will mark the attendance entry/exit for each employee every time when they swipe their ID card through the attendance terminals. It will also automatically update the attendance status in the web portal for every check-in and check-out.

URL:

https://people.zoho.com/people/api/attendance?authtoken=<authtoken>&dateFormat=<dateFormat>&checkIn=<checkin time>&checkOut=<checkout time>&empId=<employeeId>&emailId=<emailId>&mapId=<mapId>

To learn more about 'AuthToken' generation click here.

Date Format:

dd/MM/yyyy HH:mm:ss

Note:

  • Check-in and Check-out params should be in the above specified format or as specified in the Company Settings page.

Parameter Description

authtoken Specify the authentication token
dateFormat Specify the correct date format
checkin time Specify the check-in time of an employee
checkout time Specify the check-out time of an employee
employeeId Specify the employee ID of an employee
emailId Specify the email ID of an employee
mapId Specify the mapper ID of an employee

Out of the 3 parameters - Emp ID, Email ID & Map ID, at least one of them must be given as an input to map the entry of an employee. Mapper ID is the unique ID of your Attendance system like Bio metric system which marks the attendance for a specific employee.

AuthToken Generation

Please refer this link to learn more about 'AuthToken' generation.

Example of Attendance API

Programming Language

  • JAVA

Prerequisite

  • JDK 1.6
  • commons-codec-1.3.jar, commons-httpclient-3.0.1.jar and commons-logging-1.1.jar files are available in the CLASSPATH

Code Snippet

import java.io.*;
import java.util.*;
import java.net.*; import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.PartSource;
import org.apache.commons.httpclient.methods.multipart.ByteArrayPartSource;
public class TestAPI
{
public static void main(String a[])
{
try
{
String authtoken = "YOUR AUTH TOKEN";
String targetURL = "https://people.zoho.com/people/api/attendance";
String paramname = "content";
PostMethod post = new PostMethod(targetURL);
post.setParameter("authtoken",authtoken);
post.setParameter("dateFormat","dd/MM/yyyy HH:mm:ss");
post.setParameter("checkIn","09/09/2013 09:30:45");
post.setParameter("checkOut","09/09/2013 18:45:13");
post.setParameter("empId","0941");
HttpClient httpclient = new HttpClient();
PrintWriter myout = null;
/*-------------------------------------- Execute the http request--------------------------------*/
try
{
long t1 = System.currentTimeMillis();
int result = httpclient.executeMethod(post);
System.out.println("HTTP Response status code: " + result);
System.out.println(">> Time taken " + (System.currentTimeMillis() - t1));
/*-------------------------------------- Execute the http request--------------------------------*/
/* ---------------------------writing the response to a file--------------------*/
myout = new PrintWriter(new File("response.xml"));
myout.print(post.getResponseBodyAsString());
/* ---------------------------writing the response to a file--------------------*/
/*-----------------------Get response as a string ----------------*/
String postResp = post.getResponseBodyAsString();
System.out.println("postResp=======>"+postResp);
/* ---------------------Get response as a string ----------------------------*/
if(postResp.equals("Invalid Ticket Id"))
{
// generate new auth token and call the API
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
myout.close();
post.releaseConnection();
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

Example of Attendance API

Programming Language

  • C#

Prerequisite

  • C#

Code Snippet

using System.Web;
using System..Net;
string authtoken = "YOUR AUTHTOKEN HERE";
String zohopeopleurl = "https://people.zoho.com/people/api/attendance?";
string postContent = "authtoken=" + authtoken;
postContent = postContent + "&dateFormat=dd/MM/yyyy HH:mm:ss&checkIn=02/01/2014 08:00:00&checkOut=02/01/2014 05:00:00&empId=3";
string result = AccessAPI(zohopeopleurl, postContent);
public static string AccessAPI(string url, string postcontent)
{
byte[] bodyBytes = System.Text.Encoding.UTF8.GetBytes(postcontent);
HttpWebRequest request = default(HttpWebRequest);
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "Post"; //methodtype;//-post or get
request.ContentType = "application/x-www-form-urlencoded";
request.UserAgent = "Zoho Outlook plugin for people";
using (Stream ostream = request.GetRequestStream())
{
ostream.Write(bodyBytes, 0, bodyBytes.Length);
ostream.Flush();
ostream.Close();
}
HttpWebResponse response = default(HttpWebResponse);
response = (HttpWebResponse)request.GetResponse();
StreamReader strrespo = default(StreamReader);
strrespo = new StreamReader(response.GetResponseStream());
string s = null;
s = strrespo.ReadToEnd();
return s;
}

Top