Create or update needs
This endpoint allows to update or create the needs for a day.
PUT /api/v1/businesses/{businessId}/products/{productId}/needs/{yyyy-MM-dd}
In the request URL, the following parameters must be specified:
-
Business external identifier (businessId).
-
Product or section external identifier (productId).
-
Date for which the needs are created or updated in the
yyyy-MM-ddformat.
Below are the fields that make up the request body, some of which are mandatory for the request to be successful.
|
Mandatory fields are marked with an asterisk (*). |
Request body
| JSON Analysis |
|---|
Details
|
Request example
After analyzing the fields, an example of the request is shown:
PUT /api/v1/businesses/BUSINESSID/products/PRODUCTID/needs/2024-07-19
[
{
"startMinuteDay": 600,
"duration": 60,
"location": "03",
"value": 5,
"zone": "General"
},
{
"startMinuteDay": 540,
"duration": 120,
"location": "06",
"value": 2,
"zone": "General"
}
]
If all the request data is correct, the following needs will be created for the day 2024-07-19:
-
Task 03: 5 people at 10:00 with a duration of one hour.
-
Task 06: 2 people at 9:00 with a duration of two hours.
Considerations
The request takes the service time zone into account. For example, if the service is in UTC+2, the startMinuteDay field will consider that time zone.
If an empty array ([]) is sent, all needs for that day are deleted.
Error codes
In addition to the common errors, this endpoint can return the following codes:
| Code | Message | Description |
|---|---|---|
|
Location not found |
The task specified in |
|
Start minute cannot be null |
The |
Start minute should be positive |
The |
|
Duration cannot be null |
The |
|
Duration should be positive |
The |
|
Location cannot be empty |
The |
|
The value for the need should be positive or zero |
The |
|
|
- |
A conflict occurred while saving the needs. It is recommended to check that the data sent does not violate any integrity constraint. |
Useful links
What are needs?
What is the task catalog?