NCHECK API¶
NCheck API can be used by programmers to retrieve and update attendance system data in NCheck Bio Attendance Integration Manual. It can manage following information.
Users/Employees
Biometrics data
Attendance events
API credentials¶
API user name and password can be generate by NCheck Bio Attendance Integration Manual server administrator as mentioned in generate API access credentials section. Programmers can use the username and password to generate a session authentication token to use in API method calls. Authentication token expires in one week. Once it expired, the new authentication token can be generated using the same username and password. Refer section Authentication token for more detail about generating authentication token.
Authentication token¶
Session authentication token is used to authenticate API method calls. Authentication token retrieval request call using C# is shown in Figure 1
In the code following variables should be replaced with the given values
Variable |
Value |
Server_url |
The URL of the NCheck Bio Attendance Integration Manual server |
User_name |
Username for the API |
password |
Password for the API |
If the response is successful, the access token will be extracted from the access_token variable.
API’s¶
Once the access token has retrieved, API’s can be used to manage data as follows.
-
NCheck Bio Attendance Integration Manual APIs allows to add. update, delete user/employee and retrieve user/employee data from the system
-
Add/delete biometric images (Face, finger, and iris).
-
Retrieve/delete user/employee attendance events.
User employee data¶
NCheck Bio Attendance Integration Manual is providing following APIs to manage user employee data
Add/update user¶
This API can be used for add news user or change user details as shown in Table 2 .
Request: /api/ncheck/user
Method: POST
Body
User/employee as a JSON object with following information. Table 2 is showing the parameters required in the json object. Figure 2 is showing the sample JSON object with parameters.
¶ Parameter
Type
Description
Availability
employeeCode
string
Unique identification code for a user.
To update the details, add the employee code of the existing user.
Required
firstName
string
First name of the user
Required
lastName
string
Last name of the user
Required
email
string
Email address
Optional
loginName
string
Login name for the user. Login cannot change on update
Optional
password
string
Password of the user. Password cannot be changed on update
Optional
status
string
Status of the user as
0 for Active
1 for Disabled
Optional
Response
Response is a JSON Object with following information.
statusCode
String type parameter to show the status of the request. This is a required field. Available status code is shown in below.
¶ Status code
Description
INVALID_EMAIL
Email address is invalid
FIRST_NAME_EMPTY
First name is empty
Last_NAME_EMPTY
Last name is empty
INVALID_EMPCODE
Employee code is already used
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
String parameter to show the description of the status code. This is an optional field.
returnValue
Added/edited user details as json object if the status code is success as shown in Figure 3
Figure 4 is showing sample C# code to add new user.
Delete User¶
This API is using to delete an existing user.
Request: /api/ncheck/user/<employeeCode>/
Method: DELETE
Parameters
API parameters to delete user
¶ Parameter
Type
Description
Availability
employeeCode
string
Unique identification code for a user
Required
Response
Status codes are shown in Table 5 . If the status code is success, a JSON object will be received with the deleted person details as shown in Figure 5 .
¶ Status code
Description
USER_NOT_AVAILABLE
User is not found.
ERROR
System error (Need to check server logs for more information)
SUCCESS
Successful
Figure 6 Is showing the C# code sample to delete an user.
Get user¶
Existing user detail can be retrieved from this API as shown in Figure 7 .
Request: /api/ncheck/user?code=<employeeCode>
Method: GET
Parameters
¶ Parameter
Type
Description
Availability
employeeCode
string
Unique identification code for a user
Required
Response
Figure 8 Is showing the C# sample code to get the user.
Biometric data¶
User/employee biometric data images as face, fingerprint, and iris images can be managed using following APIs.
Update biometric¶
User biometric(s) including face, finger and iris can be enrolled using this API.
Request: /api/ncheck/biometric?code=<employeeCode>/
Method: POST
Parameters:
¶ Parameter
Type
Description
Availability
employeeCode
string
Unique identification code for a user
Required
Body
JSON Biometric Array with parameters as shown in Table 8 . Example JSON body has shown in Figure 9 .
¶ Parameter
Type
Description
Availability
modality
string
Biometric modality (face, finger, iris)
Required
image
byte[]
Biometric raw Image.
Optional
template
byte[]
Biometric template. Required is no image.
Optional
Response
JSON response has shown in Figure 10
statusCode
String parameter which shows the status of the request. This is a required field. Status codes are showing in following table.
¶ Status code
Description
INVALID_PARAMETERS
No biometric data sent
USER_NOT_AVAILABLE
No user available for the given employee code
SUCCESS
Successful
statusDescription
Detail of the status as a String. This is an optional field.
returnValue
Individual biometric result array as a Json object for successful requests with the following information.
statusCode
Status of the enrolled biometric. The status codes are showing in below.
¶ Status code
Description
ENROLL_FAILED
The biometric has enrolled to different user
FAILED_TO_EXTRACT
Failed to extract the biometrics
SUCCESS
Successful
statusDescription
Description of the status as a String.
ReturnVale
This is always null.
Figure 11 is showing a sample C# code to update biometrics.
Delete biometric¶
All user biometric(s) can be deleted using this API.
Request: /api/ncheck/biometric/<employeeCode>/
Method: DELETE
Parameters:
¶ Parameter
Type
Description
Availability
employeeCode
string
Unique identification code for a user
Required
Response:
JSON response is shown in Figure 12
statusCode
Request status in String. This is a required field. Available status codes are shown in below.
¶ Status code
Description
USER_NOT_AVAILABLE
User is not found
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successfull
statusDescription
Detail of the status as String. This is a required field.
returnValue: Null
Figure 13 is showing the C# code sample for delete user biometric(s).
Attendance events¶
User/employee attendance data can be managed using following APIs
Get attendance events¶
Get attendance event details of selected user for a given time range.
Request:/api/ncheck/event?code=<employeeCode>&from=<fromDateTime>&to=<toDateTime>
Method: GET
Parameters:
¶ Parameter
Type
Description
Availability
employeeCode
string
Unique identification code for a user
Optional
toDateTime
string
Formatted date time string as yyyy-MMdd HH:mm:ss
Required
toDateTime
string
Formatted date time string as yyyy-MMdd HH:mm:ss
Required
Response
All attendance events as Json array with below parameters.
statusCode
Status of the requested event details as String. This is a required field. Available status codes are shown in below.
¶ Status code
Description
USER_NOT_AVAILABLE
User is not found
INVALID_TIME_FORMAT
Date format is invalid
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
Detail of the status as String. This is a required field
returnValue
Requested event details as Json array if the status code is Success with below information.
statusCode
Status of the event detail as String. This is a required field. Status codes are shown in below
¶ Status code
Description
USER_NOT_AVAILABLE
User is not found
INVALID_TIME_FORMAT
Date format is invalid
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
Detail of the status as String. This is a required field
returnValue
Json object containing event details if the status code is Success.
employeeCode
Employee code of the user as String
inTime
Checked-in time as a date time string, formatted in yyyy-MM-dd HH:mm:ss
outTime
Checked-out time as a date time string, formatted in yyyy-MM-dd HH:mm:ss
Shift
Shift name as String. If empty, default shift is selected.
tzOffset
UTC timezone offset int. Default is 0.
Figure 15 Is showing the C# sample for get attendance events for a user
Add events¶
This API can be used for adding attendance event for user(s).
Request: /api/ncheck/event/
Method: POST
Body
JSON array object with adding event(s) details as shown in Figure 16 .
employeeCode
Employee code the user needs to delete the attendance events
inTime
Checked-in time as a date time string, formatted in yyyy-MM-dd HH:mm:ss
outTime
Checked-out time as a date time string, formatted in yyyy-MM-dd HH:mm:ss
Shift
Shift name as a String. If empty, default shift is selected.
tzOffset
Response
Response JSON Object with the status of the individual attendance events as JSON objects as shown in Figure 17
statusCode
Request status in String. This is a required field. Available status codes are shown in below.
¶ Status code
Description
INVALID_PARAMETERS
Matching event cannot be found
USER_NOT_AVAILABLE
User is not found
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
Status description as a String. This is a required field.
returnValue
Selected events details as Json array if the response status code is Success. The available details are
statusCode
Status of the deleted event as a String. This is a required field. Status codes as follows.
¶ Status code
Description
INVALID_PARAMETERS
Matching event cannot be found
USER_NOT_AVAILABLE
User is not found
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
Status description as a String. This is a required field
returnValue
Added event detail as a JSON object.
Figure 18 is showing a C# code sample for delete events
Delete events¶
This API can be used for deleting attendance event from a user.
Request: /api/ncheck/event/
Method: DELETE
Body
JSON array object with deleting event(s) details as shown in Figure 19 .
employeeCode
Employee code the user need to delete the attendance events
inTime
Checked-in time as a date time string, formatted in yyyy-MM-dd HH:mm:ss
outTime
Checked-out time as a date time string, formatted in yyyy-MM-dd HH:mm:ss
Shift
Shift name as a String. If empty, default shift is selected.
tzOffset
Response
Attendance Event Response JSON Object with the status of the individual attendance events as JSON objects as shown in
statusCode
Request status in String. This is a required field. Available status codes are shown in below.
¶ Status code
Description
INVALID_PARAMETERS
Matching event cannot be found
USER_NOT_AVAILABLE
User is not found
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
Status description as a String. This is a required field.
returnValue
Selected events details as Json array if the response status code is Success. The available details are
statusCode
Status of the deleted event as a String. This is a required field. Status codes as follows.
¶ Status code
Description
INVALID_PARAMETERS
Matching event cannot be found
USER_NOT_AVAILABLE
User is not found
ERROR
System error (Need to check server logs for more details)
SUCCESS
Successful
statusDescription
Status description as a String. This is a required field
returnValue
Deleted event detail as a JSON object.
Figure 21 Is showing a C# code sample for delete events