Add an incidence

This endpoint allows registering the information of an incidence for an employee.

POST /api/v1/import/incidence

Below is a detailed explanation of each of the fields that can make up the request body, with some being mandatory for the request to be successful.

Mandatory fields are marked with an asterisk (*).

Request body

JSON Analysis
{
  "business": "string",
  "employeeId": "string",
  "type": "string",
  "initTime": "string",
  "endTime": "string",
  "workedMinutes": 0,
  "from": "string",
  "to": "string",
  "id": "string",
  "orquestId": 0
}
json
Details
  • business*: identifier configured in Orquest for the business.

  • employeeId*: identifier of the employee linked to the incidence.

  • type*: identifier of the type of incidence. Must be previously configured in Orquest.

  • initTime: start time of the incidence. Must be in HH:mm format with the following regular expression: ^([01]\d|2[0-3]):[0-5]\d$. Refers to local time, that is, the time zone of the service.

  • endTime: end time of the incidence. Must be in HH:mm format with the following regular expression: ^([01]\d|2[0-3]):[0-5]\d$. Refers to local time, that is, the time zone of the service.

  • workedMinutes*: number of minutes the employee has worked from the start of their shift until the beginning of the incidence. If the employee has not worked, it should be specified as 0.

  • from*: date when the incidence starts. Must be in yyyy-MM-dd format.

  • to*: date when the incidence ends. Must be in yyyy-MM-dd format.

  • id: external identifier of the incidence.

  • orquestId: internal identifier of the incidence in Orquest.

Request example

Once the analysis of the different fields has been done, an example of the request body is shown:

{
  "business": "BUSINESSID",
  "employeeId": "C14A658",
  "type": "01",
  "initTime": "08:30",
  "endTime": "09:30",
  "workedMinutes": 30,
  "from": "2024-04-15",
  "to": "2024-04-15",
  "id": "C14-12545"
}
json

Considerations

This request will generate an atomic operation that can be automatically rolled back if there are errors: the error will be displayed in the response of the request.

If an incidence is not defined in the business’s incidence catalog, it cannot be assigned to any employee.

If the incidence overlaps with another incidence previously registered in the system, the request will return a 400 Bad Request error indicating error.incidence_overlapped.