Get counters with assignments (by service)
This endpoint allows querying the counter data of a service for a period not exceeding 31 days. Only assignments will be considered for the calculation.
GET /api/v2/businesses/{businessId}/services/{serviceId}/counters-with-only-assignments?businessCounterIds={id}&from={yyyy-MM-dd}&to={yyyy-MM-dd}
The identifiers to be used in the URL ( |
If the request is correct, the response will contain the counter data as shown in the following example:
GET /api/v2/businesses/BUSINESSID/services/SERVICEID/counters-with-only-assignments?businessCounterIds=4890&from=2024-11-18&to=2024-11-20
[
{
"counter": {
"id": 4890,
"counterType": {
"id": 69,
"key": "counter.sundays_worked_per_month",
"shortName": "DTM",
"scope": "MONTH",
"dataType": "INTEGER"
}
},
"counts": [
{
"key": "DTM_20241101_20241130",
"from": "2024-11-01",
"to": "2024-11-30",
"total": [
{
"employeeId": "152020",
"count": 0.0
},
{
"employeeId": "152017",
"count": 1.0
},
{
"employeeId": "152014",
"count": 0.0
}
]
}
]
}
]
In this example, the counter shows the number of Sundays worked per month by each employee of the service.
This counter is represented in days: 1.0
equals one day.
Considerations
The response will depend on the counter’s configuration, such as its scope (weekly, monthly, yearly, etc.) or its data type (minutes, days, etc.).
It is possible to retrieve data for multiple counters in the same request by including different identifiers in the URL, separated by commas: ?businessCounterIds=id1,id2,…
.
If any of these identifiers do not match those of the business, the request will return an error indicating No value present.
If there are no assignments impacting the counter for the specified period in the URL, the counter will display 0.0
.
If the query period exceeds 31 days, the request will return a 406 Not Acceptable
error, indicating The request exceeded the maximum number of days allowed (31 days max).
Employees without an external identifier configured in the system (employeeId
) will not appear in the response.
Useful links
What is a counter?
What is an assignment?