Overview
The SPORTident Center REST API provides a minimal, simple and efficient interface to interact with SPORTident Center.
The API is currently in Beta, which means that it could still change in an incompatible way after we receive feedback and opinions from early adaptors. We will inform all current users, should the API change.
Using the API
Authentication
All requests to the API need to be authorised. The user authenticates with his
or her API key via the HTTP header apikey
. The API key is available via the
Center Admin Frontend: My Account > API key.
HTTP compression
SPORTident Center supports HTTP compression on upload (POST method) and download (for all methods, but only for content-type "application/json", "text/xml" and "text/csv").
To upload gzip-compressed
data to the server, the client needs to set the header Content-Encoding: gzip
.
To request a gzip-compressed response, the client may set the header Accept-Encoding: gzip
. The response may or may not be compressed, which is indicated by whether the Content-Encoding: gzip
header is set in the response or not. Very small payloads are not compressed.
Resources
Events
Retrieve punches for an event
Resource URL
GET /api/rest/v1/public/events/{eventId}/punches
Description
Retrieve punches for an event. The event id is available via the Center Admin Frontend: Events > Event > Settings.
The punches can be retrieved as JSON or CSV formatted data. The requested format has to be specified in the Accept
header of the request.
Filtering of the punches is possible with the query parameters afterId
and limit
as listed below.
Typically, to retrieve punches "live" for a running event, you would poll the
REST API in a loop (e.g. every ten seconds), starting with afterId=0
(punch
ids are always greater than zero) and then increasing afterId
to the so far
largest returned punch id in each iteration (the returned punches are ordered
ascending by punch id).
Simple punch format
Field | Description |
---|---|
id |
Uniquely identifies this punch |
card |
SPORTident card number (SIID) |
time |
Punch time (local time) in milliseconds since the Epoch (1970-01-01 00:00:00) |
code |
Control code |
mode |
Punch mode (e.g. Control, Start, Finish, BcControl, etc) |
Query parameters
Parameter | Description |
---|---|
|
(Optional) Get all punches after this id. |
|
(Optional) Return a maximum number of [limit] punches |
|
(Optional) Return punches in the specified punch format. Currently only "simple" is supported, which is the default as well. |
Request headers
Name | Description |
---|---|
|
API key to authenticate the user |
|
Return punches in the specified format. Acceptable values are "application/json" and "text/csv". |
|
application/json;charset=UTF-8 |
Response headers
Name | Description |
---|---|
|
Returned number of punches, Total number of selected punches |
Examples
Curl request to get punches as JSON
$ curl 'https://center-origin.sportident.com/api/rest/v1/public/events/2613/punches?afterId=6919&projection=simple&limit=5' -i -X GET \
-H 'Accept: application/json' \
-H 'apikey: 25675c97-8015-1783-2410-d93d0035a1e7' \
-H 'Content-Type: application/json;charset=UTF-8'
Retrieve punches as JSON with parameter afterId
Request:
GET /api/rest/v1/public/events/2613/punches?afterId=6919&projection=simple&limit=5 HTTP/1.1
Accept: application/json
apikey: 25675c97-8015-1783-2410-d93d0035a1e7
Content-Type: application/json;charset=UTF-8
Host: center-origin.sportident.com
Response:
HTTP/1.1 200 OK
Vary: origin,access-control-request-method,access-control-request-headers,accept-encoding
X-Count: 5,95
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Encoding: gzip
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 16 Dec 2024 19:39:30 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 807
[ {
"id" : 6920,
"modem" : "499990",
"card" : 8888893,
"time" : 1734381544484,
"code" : 49,
"mode" : "BcControl",
"receptionTime" : 1734377942000
}, {
"id" : 6921,
"modem" : "499990",
"card" : 8888894,
"time" : 1734381545488,
"code" : 50,
"mode" : "BcControl",
"receptionTime" : 1734377942000
}, {
"id" : 6922,
"modem" : "499990",
"card" : 8888895,
"time" : 1734381546492,
"code" : 51,
"mode" : "BcControl",
"receptionTime" : 1734377942000
}, {
"id" : 6923,
"modem" : "499990",
"card" : 8888896,
"time" : 1734381547496,
"code" : 52,
"mode" : "BcControl",
"receptionTime" : 1734377943000
}, {
"id" : 6924,
"modem" : "499990",
"card" : 8888897,
"time" : 1734381548500,
"code" : 53,
"mode" : "BcControl",
"receptionTime" : 1734377943000
} ]
JSON access denied response
HTTP/1.1 403 Forbidden
Vary: origin,access-control-request-method,access-control-request-headers,accept-encoding
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Encoding: gzip
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 16 Dec 2024 19:33:17 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 406
{
"errors" : [ {
"entity" : "AccessDeniedException",
"cause" : "AccessDeniedException",
"message" : "User 'firstNametestuser2 lastNametestuser2' is not authorised to access event '131'",
"detailMessage" : "User 'firstNametestuser2 lastNametestuser2' is not authorised to access event '131'",
"url" : "https://center-origin.sportident.com/api/rest/v1/public/events/131/punches"
} ]
}
Retrieve punches as CSV
Request:
GET /api/rest/v1/public/events/2613/punches?projection=simple&limit=5 HTTP/1.1
Accept: text/csv
apikey: 25675c97-8015-1783-2410-d93d0035a1e7
Host: center-origin.sportident.com
Response:
HTTP/1.1 200 OK
Vary: origin,access-control-request-method,access-control-request-headers,accept-encoding
X-Count: 5,100
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Encoding: gzip
Content-Type: text/csv;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 16 Dec 2024 19:39:30 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 267
ID,CODE,CARD,TIME,MODE,MODEM
6915,44,8888888,1734381539464,BcControl,499990
6916,45,8888889,1734381540468,BcControl,499990
6917,46,8888890,1734381541472,BcControl,499990
6918,47,8888891,1734381542476,BcControl,499990
6919,48,8888892,1734381543480,BcControl,499990