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",
"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 status; therefore, each element is updated independently.
A maximum of 30 elements is allowed in the request body.
User validation
When data from the user object is included, the system validates whether the user exists in Orquest. The following scenarios are possible:
-
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, its information is updated. The
usernamefield is not updated; onlyemail,nodes, androlescan be modified. -
If the user exists and is linked to another employee, the operation is cancelled, and the request returns a
409 Conflicterror.
If the email address format is invalid, the request returns a 406 Not Acceptable error with the message User email is not valid.
In the roles field, the role name must exactly match one defined in the system under Business Configuration > Roles.
If any of the roles do not match those defined at the business level, the request returns a 409 Conflict error with the message some role is not valid.
Previously defined nodes and roles remain unchanged when the request is made without including these user fields.
|
An integration user can assign any role defined at the business level. |
|
If the employee category ( |