Create or update employee (complex)
This endpoint allows adding an employee or modifying their data using their identifier (employeeId). You can add or modify all employee data, including linked user, contracts, service associations, etc.
PUT /api/v2/businesses/{businessId}/employees/{employeeId}
Below is a detailed explanation of each field that can make up the body of the request, with some fields being mandatory for a successful request.
|
Mandatory fields are marked with an asterisk (*). |
Request body
| JSON Analysis |
|---|
Details
|
Object person* Includes personal data of the employee identified through their employeeId. |
Details
|
Object user Includes data linking the employee to a user in the Orquest application. |
Details
|
Object serviceAssociations Includes information related to service associations established for the employee. |
Details
|
Object contracts Includes information regarding the contracts applied to the employee, in terms of hours worked, labor limitations, etc. |
Details
|
Request example
Once the analysis of the different fields is done, 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
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 ( |