Add service time

This endpoint allows saving service times by day type within a specific period.

PUT /api/v1/businesses/{businessId}/services/{serviceId}/periods/{periodId}/service-times

The fields that make up the body of the request are detailed below, some of which are mandatory for it to be carried out successfully.

Mandatory fields are marked with an asterisk (*).

Request body

JSON analysis
{
    "dayType": {
        "name": "string"
    },
    "type": "string",
    "openingHours": {
        "start": 0,
        "end": 0
    },
    "serviceHours": {
        "start": 0,
        "end": 0
    },
    "restHours": [
        {
            "start": 0,
            "end": 0
        }
    ]
}
Details
  • dayType*: type of day. It can be a system day type or one created at the business level.

    • name*: name of the day type.

  • type*: type of service time. It can take one of the following values: OPEN, CLOSE, OPEN_HOLIDAY, and CLOSE_HOLIDAY. Both CLOSE and CLOSE_HOLIDAY apply to the entire day, from 0 to 1440.

  • openingHours*: service opening hours. The value is expressed in minutes since midnight (00:00 local time).

    • start*: start of the interval expressed in minutes since midnight.

    • end*: end of the interval expressed in minutes since midnight.

  • serviceHours*: public service hours. The value is expressed in minutes since midnight (00:00 local time).

    • start*: start of the interval expressed in minutes since midnight.

    • end*: end of the interval expressed in minutes since midnight.

  • restHours: interval, if applicable, during which the service will be closed. The value is expressed in minutes since midnight (00:00 local time).

    • start*: start of the interval expressed in minutes since midnight.

    • end*: end of the interval expressed in minutes since midnight.

Request example

Once the different fields have been analyzed, an example of the request body is shown below:

{
    "dayType": {
        "name": "SUNDAY"
    },
    "type": "OPEN",
    "openingHours": {
        "start": 0,
        "end": 0
    },
    "serviceHours": {
        "start": 540,
        "end": 1260
    },
    "restHours": [
        {
            "start": 840,
            "end": 870
        },
        {
            "start": 1080,
            "end": 1110
        }
    ]
}

If all data is correct, an open schedule (OPEN) will be created for Sunday (SUNDAY) with the following intervals:

  • Open 24 hours.

  • Public service hours from 9:00 (540) to 21:00 (1260).

  • Break from 14:00 (840) to 14:30 (870) and from 18:00 (1080) to 18:30 (1110).

Considerations

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

If the period specified in the URL does not exist, the request will return a 404 Not Found error indicating Period not found. You can check the different periods of a service through this request.

The day type name (name) must exactly match a system day type or one defined at the business level. If it does not match, the request will return an error.

If the service time type does not match the predefined values, the request will return a 400 Bad Request error.

Fields expressed in minutes since midnight take into account the service time zone. For example, if the service is in UTC+2, 540 refers to 09:00 UTC+2. The allowed values for these fields range from 0 to 1440.

What is a service? And what is a service time?

What is a day type?