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-dd
format.
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.
If the task is not registered in the business task catalog or does not have an external identifier, the request will return a 404 Not Found
error indicating Location not found.
If the external identifier of the zone does not match any zone in the product, the request will return an error indicating No zone found.
If any of the mandatory fields are not sent, the request will return a 406 Not Acceptable
error indicating which field is missing in the request body.
Useful links
What are needs?
What is the task catalog?