Get counters with clockguards (by service)

This endpoint allows querying the counter data of a service for a period not exceeding 31 days. Only consolidated clockguards will be considered for the calculation.

GET /api/v2/businesses/{businessId}/services/{serviceId}/counters-with-only-clockguards?businessCounterIds={id}&from={yyyy-MM-dd}&to={yyyy-MM-dd}

The identifiers to be used in the URL (businessCounterIds) are those linking the business to the counter. These identifiers can be consulted here.

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-clockguards?businessCounterIds=4035&from=2024-11-18&to=2024-11-20
[
    {
        "counter": {
            "id": 4035,
            "counterType": {
                "id": 1,
                "key": "counter.weekly_net_hours",
                "shortName": "HNS",
                "scope": "WEEK",
                "dataType": "TIME"
            }
        },
        "counts": [
            {
                "key": "HNS_20241118_20241124",
                "from": "2024-11-18",
                "to": "2024-11-24",
                "total": [
                    {
                        "employeeId": "1006350",
                        "count": 0.0
                    },
                    {
                        "employeeId": "1006356",
                        "count": 120.0
                    },
                    {
                        "employeeId": "1006352",
                        "count": 0.0
                    }
                ]
            }
        ]
    }
]

In this example, the counter displays the weekly net hours worked by each employee of the service. This counter is represented in minutes: 120.0 equals two hours.

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 consolidated clockguards 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.

What is a counter?