Create or update employee list (complex)
This endpoint is one of the most complex endpoints in Orquest. It not only allows creating or modifying the employee list itself but also all associated data such as users, contracts, service associations, etc.
PUT /api/v2/businesses/{businessId}/employees
Here is a detailed explanation of each of the fields that can comprise the request body, with some of them being mandatory for the request to be successful.
Mandatory fields are marked with an asterisk (*). |
Request body
JSON Analysis |
---|
Details
|
Object person* Includes the personal data of the employee identified through their employeeId. |
Details
|
Object user Includes the data linking the employee to a user in the Orquest application. |
Details
|
Object serviceAssociations Includes information regarding service associations established for the employee. |
Details
|
Object contracts Includes information regarding the contracts that apply to the employee, in terms of working hours, labor restrictions, etc. |
Details
|
Request example
After analyzing the different fields, an example of the request body is shown:
[
{
"business": "BUSINESSID",
"lag": 0,
"partial": false,
"ignoreWithoutOuterId": false,
"ignoreServiceAssociations": false,
"ignoreContracts": false,
"person": {
"name": "Brian",
"surname": "Cohen",
"group": "01",
"email": "brian@orquest.com",
"birthday": "1987-12-01",
"employeeId": "021298521",
"metadata": {
"language": "english",
"nationality": "scottish"
},
"seniority": "2021-12-01",
"aptitudes": [
{
"productId": "C14",
"aptitudes": [
{
"locationId": "101",
"level": 3
},
{
"locationId": "102",
"level": 2
}
]
}
],
"virtual": false
},
"user": {
"username": "brian",
"email": "brian@cohen.com",
"nodes": [
10, 14
],
"roles": [
"admin"
]
},
"serviceAssociations": [
{
"ownerProduct": "C14",
"product": "C14",
"from": "2024-04-11",
"to": null,
"splitPresence": true,
"unplannable": false,
"card": "C14A658",
"roles": [
"manager"
],
"disponibility": [
{
"from": "2024-04-11",
"to": null,
"ranges": [
{
"dayType": "ALL",
"startMinuteDay": 600,
"duration": 300
}
]
}
],
"regularCessions": [
{
"product": "C15",
"minutes": 60,
"days": [
"MONDAY"
]
}
],
"metadata": {
"restAllowed": true,
"time": 15,
"position": "free"
},
"id": "asb1415"
}
],
"contracts": [
{
"from": "2024-04-11",
"to": null,
"regularMinutes": 2400,
"weeklyContract": true,
"countingDays": "MONDAY_SUNDAY",
"additionalMinutes": 360,
"regularControlPeriod": "WEEKLY",
"regularPeriodMultiplier": 1,
"regularPeriodStartDate": "2024-04-11",
"additionalControlPeriod": "WEEKLY",
"additionalPeriodMultiplier": 1,
"additionalPeriodStartDate": "2024-04-11",
"calendarDaysOff": true,
"numberOfHolidays": 25,
"numberOfPublicHolidays": 7,
"weeklyDaysInvolved": "MONDAY_SUNDAY",
"metadata": {
"full": true,
"days": 215,
"taxProfit": "none"
},
"costPerHour": 200.34,
"personCategory": "DE125",
"id": "321abc654def",
"contractTypeId": "07H",
"completed": false
}
]
}
]
Considerations
Each entity in the list has its own state, meaning each element of the list has its own set of attributes or properties that can be updated independently. No more than 30 elements are allowed in the request body.
Each entity will generate an atomic operation that can be automatically rolled back if there are errors: the error will be displayed in the response to the request.
If data from the user object is included, the existence of that user in Orquest is validated, so the following scenarios are established:
-
If the user does not exist, it is created and linked to the employee.
-
If the user exists and is already linked to the employee in the request, the information is updated.
-
If the user exists and is linked to another employee, the operation is canceled and returns
HTTP 409 - Conflict
, indicating the conflict with error details in the response body.
If the employee category ( |