Counter (instances)
Introduction
Through the API there’s a possibility to retrieve counters.
This page describes the counter-“instances” as you can see them in a person’s day details in myProtime. From here on, these counter-“instances” will just be called “counters”; everything else will be named more specifically, e.g., counter-definitions and counter-requests.
Properties
Property | Type | Description |
---|---|---|
id |
integer | Unique identifier for the counter instance. |
shiftDefinition.id |
integer | Unique identifier for the shift definition, if a shift is linked to this counter. |
numberOfInstances |
integer | Number of counter instances. |
request.id |
string | Internal unique identifier for the related request, if the counter was requested. |
status |
string | Status of the counter instance (Unknown , Auto , Manual , Calendar ). |
isAuthorized |
boolean | Indicates if the counter instance is authorized. |
person.id |
integer | Unique identifier for the person linked to this counter. |
counterDefinition.id |
integer | Unique identifier for the counter definition linked to this counter. |
date |
string | Date of the counter instance that it is registered on. |
startTimeInMinutes |
integer | Start time in minutes from midnight. |
endTimeInMinutes |
integer | End time in minutes from midnight. |
durationInMinutes |
integer | Duration of the counter instance in minutes. |
The shiftDefinition
property is typically linked to the counter, unless the shift is inherited from the schedule.
In cases where the shift comes from the schedule, the shiftDefinition is not included in the response. If the shift isn’t inherited from the schedule, the shiftDefinition will be included in the response.
External references
It’s possible to use predefined external references and custom external references. More information can be found on the External References Page
For a list of predefined external references, see the external reference options section.
Example to request a counter code:
GET https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/counters?filter=person in (1,2,3) and date ge '2024-01-01' and date le '2024-01-05' &externalReferences=(counter-definitions,@counter-code)
Endpoints
Below you can find the supported endpoints for this data collection.
GET a counter by Id
You can retrieve a counter by the internal ID using the GET call. Internal IDs for counters can be found by listing all counters using the GET collection endpoint.
GET https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/counters/{id}
GET a list of counters
You can retrieve a list of counters using a filter.
GET https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/counters
Filter requirements
- People are optional
- Date range (required with max of 1 year range)
- Counter definitions are optional
- Status: one or more are optional
Example with people and employee number:
GET https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/counters?filter=person in (1,2,3) and date ge '2025-01-01' and date le '2025-01-05' &externalReferences=(people,@employee-number)
Check the Fetching Resources page on how to use the filter.
Delta
It’s possible to retrieve changes with the delta. Check the Delta page for more general and critical information on how to use this feature.
Filter requirements when using the delta
- People cannot be used in the delta
- The start date must be a recent date in the past, with the earliest allowed start date being January 1st of the previous year
- The end date isn’t required, when providing an end date there is a max range of 1 year
- Counter definitions are optional
- Status: one or more are optional
Example for counters with a delta:
GET https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/counters?filter=date ge '2025-01-01'&externalReferences=(people,@employee-number)(counter-definitions,@counter-code)&delta
Webhooks
It’s possible to retrieve change-events with webhooks. Check the Webhooks page for more general and critical information on how to use this feature.
Example for creating a webhook for counters:
POST https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/webhooks
{
"destinationUrl": "https://www.fictional-customer.com/protime/counters",
"collectionName": "counters"
}