6. Downloading Clock Records via API
Downloading CLOCKING Records from Go2Clock Instance
Date Download
To download clocking records you will send a POST request to the Go2Clock server for a selected date.
The web address format you are going to send in is as follows...
Base URL format: app.go2clock.com/api/punches/
Header Authentication Parameter: APIKEY=xxxxxxxxxxx This must match API key value in Go2Clock instance.
Body: Is made up of a JSON key pair value in the format of application/x-www-form-urlencoded,
for example... field1=value1
Required Key field: punch_date
Get records for the date must be in this format: yyyy-mm-dd
Example Postman Request
Here’s how the configuration will look in Postman:
- Method: POST
- URL: https://app.go2clock.com/api/punches/
- Headers:
- APIKEY: xxxxxxxxxxx
- Content-Type: application/x-www-form-urlencoded
- Body (x-www-form-urlencoded):
- punch_date=2024-09-01
Example cURL command:
curl --location --request POST 'https://app.go2clock.com/api/punches/' \ --header 'APIKEY: xxxxxxxxxxx' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'punch_date=2024-09-01'
Date Range Download
To download clocking records you will send a POST request to the Go2Clock server for a selected start and end date.
The web address format you are going to send in is as follows...
Base URL format: app.go2clock.com/api/punches_range/
Header Authentication Parameter: APIKEY=xxxxxxxxxxx This must match API key value in Go2Clock instance.
Body: Is made up of a JSON key pair value in the format of application/x-www-form-urlencoded,
for example... field1=value1, field2=value2
Required Key field: start_date, end_date
Get records for the dates must be in this format: yyyy-mm-dd.
Example Postman Request
Here’s how the configuration will look in Postman:
- Method: POST
- URL: https://app.go2clock.com/api/punches_range/
- Headers:
- APIKEY: xxxxxxxxxxx
- Content-Type: application/x-www-form-urlencoded
- Body (x-www-form-urlencoded):
- start_date=2024-09-01
- end_date=2024-09-02
- userid=xxxx - Note that if you remove this param then all users records will be returned.
Note: Extended range periods may result in very large data sets being returned, we do not recommend data over 7 days being downloaded in one API call.
Example cURL command with date range:
curl --location --request POST 'https://app.go2clock.com/api/punches_range/' \ --header 'APIKEY: xxxxxxxxxxx' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'start_date=2024-09-02' \ --data-urlencode 'end_date=2024-09-04'
Example cURL command with date range by employee ID number:
curl --location --request POST 'https://app.go2clock.com/api/punches_range/' \
--header 'APIKEY: xxxxxxxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-raw '{
"start_date": "2020-01-01",
"end_date": "2025-01-31",
"userid": "7"
}'
Server Responses
The server will respond with an array of key values for each user, below is an example...
{
"status": "success",
"message": [
{
"id":4977262,
"userid":2,
"checktime":"2024-09-02 08:22:01",
"checktype":0,
"sensorid":0,
"worktype":0,
"deleted":null,
"reason":null,
"hidden":0,
"hidden_reason":null,
"devicename":null,
"eventdescription":"",
"latitude":0,
"longitude":0,
"deviceserial":1234567890,
"created_at":"2024-09-02 07:22:03",
"location_name":"Office"
}
],
"error": ""
}