Attendance check-in and check-out API
This API can be used to capture the check-in and check-out entries of an individual employee.The system will mark the attendance exit/entry of individual employees.It will automatically update the attendance status in the web portal for every check-in and check-out.
Note:This API is ideal for minimal entries. For bulk entries, you can use Attendance Bulk Import API.
Request URL
https://people.zoho.com/people/api/attendance?dateFormat=<dateFormat>&checkIn=<checkin time>&checkOut=<checkout time>&empId=<employeeId>&emailId=<emailId>&mapId=<mapId>
Header:
Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Request Parameters
dateFormat | Specify the correct date format |
checkIn | Specify the check-in time of an employee |
checkOut | Specify the check-out time of an employee |
empId | Specify the employee ID of an employee |
emailId | Specify the email ID of an employee |
mapId | Specify the mapper ID of an employee |
Note:
- Check-in and Check-out parameters should be in dd/MM/yyyy HH:mm:ss date format.
- 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 Biometric system which marks the attendance for a specific employee.
Threshold Limit: 100 requests | Lock period: 5 minutes
Threshold Limit - Number of API calls allowed within a minute.
Lock Period - Wait time before consecutive API requests.
Attendance check-in and check-out Prerequisite
CopiedJDK 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
​Header
Header
CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Sample Response
Copiedimport 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 targetURL = "https://people.zoho.com/people/api/attendance";
String paramname = "content";
PostMethod post = new PostMethod(targetURL);
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();
}
}
}