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 |
|---|
Details
|
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
The day type name (name) must exactly match a system day type or one defined at the business level.
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 1439.
If a service time is already defined for the same day type within the period, it will be overwritten with the data in the request.
Error codes
In addition to the common errors, this endpoint can return the following codes:
| Code | Message | Description |
|---|---|---|
|
- |
The |
|
Period not found |
The |
Day type not found |
The name specified in |
|
|
must not be null |
One of the required fields is missing ( |
must be greater than or equal to 0 / must be less than or equal to 1439 |
One of the minute fields is outside the allowed range ( |
|
contained_service_time |
The break time ( |
|
invalid_service_time_rest |
The break times ( |
|
|
- |
A conflict occurred while saving the service time. It is recommended to check that the data sent does not violate any integrity constraint. |
Useful links
What is a service? And what is a service time?
What is a day type?
How to get the periods of a service?