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",
"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
This request will generate an atomic operation that can be automatically reverted 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 ( |