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
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.
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?