Create or update a request
This endpoint allows to update or create a request for an employee.
PUT /api/v1/businesses/{businessId}/requests
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 different fields, here is an example of the request body:
{
"employeeId": "1006349",
"status": "REQUESTED",
"type": "MAYBE",
"from": "2024-07-25",
"to": "2024-07-25",
"fromHour": "10:00",
"toHour": "12:00",
"comments": "I could work at this time, depending on my other shifts.",
"recover": "NONE"
}
If all data is correct, a request will be generated with the following characteristics:
-
Status: requested.
-
Day: July 25, 2024.
-
Availability from 10:00 to 12:00.
-
Worked? Maybe.
Additionally, the reason for making the request will be added.
Considerations
The NON_WORKED
type does not accept the fromHour
or toHour
fields, as it is a request for a full day off.
If data is sent for any of these fields, the request will return a 406 Not Acceptable
error indicating Non worked request cannot have fromHour or toHour.
However, the NON_WORKED
request type is accepted if these fields are sent as null
.
If the employee identifier is incorrect, the request will return a 404 Not Found
error indicating Employee not found.
Useful links
What is a request?