Attendance Bulk Import API
This API is used to bulk import the check-in and check-out details of the employees. The system will mark the attendance entry/exit for all of the employees, in a bulk, once their ID cards are swiped through the attendance terminals.You can integrate this API with the attendance terminals in your organization to map the user ID of employees.
Request URL
https://people.zoho.com/people/api/attendance/bulkImport?data=<JSONArray>;
Header:
Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Request parameter
| data | [{"empId":"1","checkIn":"2014-11-07 09:01:00","location":"Chennai","building":"Administration"}, {"empId":"1","checkOut":"2014-11-07 18:02:00"}, {"empId":"2","checkIn":"2014-11-07 09:01:00","location":"Chennai","building":"Administration"}, {"empId":"2","checkOut":"2014-11-07 18:02:00"}] |
| dateFormat | yyyy-MM-dd HH:mm:ss |
Note: Attendance Bulk Import API can also be done using Attendance Device Integration.
Threshold Limit: 10 requests | Lock period: 5 minutes
Threshold Limit - Number of API calls allowed within a minute.
Lock Period - Wait time before consecutive API requests.
Break Entry in Bulk Import API
This API is used to add breaks along with attendance entries in bulk import
Request URL
https://people.zoho.com/api/attendance/bulkImport
Header:
Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Scope:
ZOHOPEOPLE.attendance.ALL (or) ZOHOPEOPLE.attendance.CREATE
Method:
POST
Request parameter:
| Parameter | Type | Description |
| data * | JSON | [{"checkIn": "dateTime", "checkOut": "dateTime", "empId": "", "breakName": "", "breakId": ""}] |
timeZone* | string | data time zone |
toTimezone | string | to time zone |
pluginConf * | string | JSON |
dateFormat* | string | Date and time format of the provided dateTime |
Examples:
| Parameter | Example |
| data * | [ { "checkIn":"26-Jul-2026 12:35", "checkOut":"26-Jul-2026 13:03", "empId":"1", "breakName":"Man-payable", "breakId": "28397489023748923"}] |
timeZone* | IST |
toTimezone | IST |
pluginConf * | {} |
dateFormat* | dd-MMM-yyyy |
Note:
- A break entry must have both check-in and check-out times, and the previous attendance entry must have a valid check-out time.
- If a break entry has an invalid break name or ID, it will be added as a normal check-in and check-out entry instead of a break entry.
Threshold Limit: 10 requests/minute | Lock period: 5 minutes
Threshold Limit: 100 requests/hour | Lock period: 1 hour
Threshold Limit: 1000 requests/day | Lock period: 6 hour
Threshold Limit - Number of API calls allowed within a time period.
Lock Period - Wait time before consecutive API requests.
Prerequisite
JDK 1.6 commons-codec-1.3.jar, commons-httpclient-3.0.1.jar and commons-logging-11.jar files are available in the CLASSPATH
Header:
CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxfCode Snippet (For Check In and Check Out)
Copiedimport java.io.*;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.json.JSONArray;
import org.json.JSONObject;
public class JavaCode { public static void main(String a[]) { try { JSONArray array = new JSONArray();
JSONObject val = new JSONObject();
val.put("empId", "1");
val.put("location", "Chennai");
val.put("checkIn", "2014-11-07 09:01:00");
val.put("building", "Administration");
array.put(val);
val = new JSONObject();
val.put("empId", "1");
val.put("checkOut", "2014-11-07 09:01:00");
array.put(val);
String targetURL = "https://people.zoho.com/people/api/attendance/bulkImport";
String dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
PostMethod post = new PostMethod(targetURL);
post.setParameter("dateFormat", dateTimeFormat);
post.setParameter("data", array.toString());
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();
} } }Copiedusing System.Web;
using System..Net;
String zohopeopleurl = "https://people.zoho.com/people/api/attendance?";
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&location=Chennai&building=Administration";
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";
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;
}Copied$request_url = 'https://people.zoho.com/people/api/attendance'; $dateFormat = "dd/MM/yyyy HH:mm:ss"; $checkIn = "29/10/2014 09:05:00"; $checkOut = "29/10/2014 17:30:00"; $empID = "1"; $location = "Chennai"; $building = "Administration"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); "&checkIn=" . $checkIn . "&checkOut=" . $checkOut . "&dateFormat=" . $dateFormat . "&empId=" . $empID . "&location=" . $location . "&building=" . $building; curl_setopt($ch, CURLOPT_POSTFIELDS, $request_param); curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); $response_info = curl_getinfo($ch); curl_close($ch); $response_body = substr($response, $response_info['header_size']); echo '\nRequest Parm : ' . $request_param; echo "\nResponse HTTP Status Code : "; echo $response_info['http_code']; echo "\nResponse" . $response_body; ?>Sample Request
Copiedhttps://people.zoho.com/api/attendance/bulkImportSample Response - Success:
Copied{
"response": "success"
}Sample Response - Failure:
Copied{
"skippedEmpInfo": [
"23809472390"
],
"response": "success"
}