Get incidences by service

This endpoint allows querying the registered incidences linked to a service within a specified period of time not exceeding 30 days.

GET /api/v2/businesses/{businessId}/services/{serviceId}/incidences/from/{yyyy-MM-dd}/to/{yyyy-MM-dd}

If the data included in the request is correct — both the businessId and the serviceId —, the response will contain the list of incidences for the service within the defined time interval:

[
    {
        "personId": "1006350",
        "from": "2024-05-08",
        "to": "2024-05-08",
        "initTime": "09:30",
        "endTime": "10:00",
        "workedMinutes": 30,
        "type": {
            "id": "01",
            "name": "Medical appointment",
            "shortName": "MA",
            "fullDay": false,
            "color": "#60b5ff",
            "calculationType": "DURATION",
            "holidays": false
        }
    },
    {
        "personId": "1006350",
        "from": "2024-05-18",
        "to": "2024-05-18",
        "initTime": "08:30",
        "endTime": "09:00",
        "workedMinutes": 0,
        "type": {
            "id": "01",
            "name": "Medical appointment",
            "shortName": "MA",
            "fullDay": false,
            "color": "#60b5ff",
            "calculationType": "DURATION",
            "holidays": false
        }
    },
    {
        "personId": "1006351",
        "from": "2024-05-08",
        "to": "2024-05-18",
        "workedMinutes": 0,
        "type": {
            "id": "02",
            "name": "Holidays",
            "shortName": "HOL",
            "fullDay": true,
            "color": "#5ea226",
            "calculationType": "PROPORTIONAL",
            "workedDays": 7,
            "holidays": true
        }
    },
    {
        "personId": "1006351",
        "from": "2024-05-01",
        "to": "2024-05-01",
        "initTime": "08:30",
        "endTime": "09:00",
        "workedMinutes": 30,
        "type": {
            "id": "01",
            "name": "Medical appointment",
            "shortName": "MA",
            "fullDay": false,
            "color": "#60b5ff",
            "calculationType": "DURATION",
            "holidays": false
        }
    }
]

As seen in the example, the request will return the information previously defined in the catalog of incidences: name, abbreviation, etc.

Considerations

The initTime and endTime fields return the local time, that is, the time zone configured for the service.

If there are no incidences for the indicated period, the request will return an empty array [].

If the interval specified in the URL exceeds 30 days, the request will return a 406 Not Acceptable error.

If the service specified in the URL does not exist in the business, the request will return a 404 Not Found error, specifying in the message not exists.