Work-contract object

PropertyDescriptionCommentConfiguration API
idWork-contract identifierread-onlyN/A
ownerIdIdentifier of the employeeMandatory (upon creation). Then, read-only./api/v3/users
externalIdWritable identifier of this work-contract.May not be uniqueN/A
typeIdIdentifier of the work-contract template.Mandatory (for creation). Determines available properties on the contract./directory/api/work-contract-archetypes
startsOnStart dateMandatory (for creation). Format: yyyy-mm-dd.N/A
isApplicableApplicable work contract is the contract that applies at the moment. In the following order: (1) Ongoing contract, (2) Upcoming contract or (3) Last contract.read-onlyN/A
establishmentIdIdentifier of the establishment.Required./organization/structure/api/establishments
spcIdSocio-professional category.Optional/organization/structure/api/occupation-categories
hiringTypeIdIdentifier of a hiring type.Optional/directory/api/work-contract-hiring-types
trialPeriodDaysNumber of days of the initial trial period.integerN/A
renewedTrialPeriodDaysNumber of days of the trial period with renewalintegerN/A
trialPeriodEndDateInitial trial period end date.Format: yyyy-mm-dd. Read only.N/A
trialPeriodEndDate2Renewed trial period end date.Format: yyyy-mm-dd. Read only.N/A
temporaryContractGroundIdIdentifier of the temporary contract ground./directory/api/work-contract-temporary-contract-grounds
internshipSupervisorIdIdentifier of the employee that acts as internship supervisor.Optional/api/v3/users
endsOnEnd date.Format: yyyy-mm-dd.N/A
terminationReasonIdIdentifier of the termination reason./directory/api/work-contract-termination-reasons
authorIdIdentifier of the user that created this work-contract.Read-only/api/v3/users
lastModifierIdIdentifier of the user that last updated this work-contract.Read-only/api/v3/users
createdAtTimestamp of the moment this work-contract was created.Read-onlyN/A
lastModifiedAtTimestamp of the moment this work-contract was lasts updated.Read-onlyN/A

General information

The property available for a contract is defined according to its model (type). These templates are set here: https://instance.ilucca.net/directory/settings/work-contracts/types

It is therefore impossible to define a value for a property that is not present on the corresponding contract template.

Similarly, for all drop-down type properties, each entry in the list can be enabled or disabled depending on the template.

Validations are also carried out to ensure that there is no overlap between two contracts for the same employee. Temporal consistency is also checked for the end of the trial period 1, 2 as well as for the start and end dates of the contract.

Work contract APIs

Retrieve all work contracts

GET /directory/api/4.0/work-contracts HTTPS/2
Host: example.ilucca.net

Query parameters available:

  • Limit (integer) : define maximum number of work contracts that are retrieve from the API (40 by default)
  • ownerId (integer) : to retrieve all work contracts for a specific employee
  • isApplicable (boolean) : allows you to retrieve only the applicable contracts or all the others (a past or future contract can be an applicable contract if there is no current contract)
  • isArchived (boolean)
  • typeId (integer) : allows you to filter on contracts of a given type
  • establishmentId (integer) : allows you to filter contracts according to the establishment to which they are attached

Retrieve one work contract

GET /directory/api/4.0/work-contracts/{workContractId} HTTPS/2
Host: example.ilucca.net

Create a work contract

POST /directory/api/4.0/work-contracts HTTPS/2
Host: example.ilucca.net

Two possible scenarios :

  1. Existing user: in this case, it will be necessary to put a contract end date on the current contract before creating a new contract.
  2. New user: when you create a new user, you have two options:
    1. recommended POST /api/v3/users?contract=true: this will create the user and his contract. It will therefore be necessary to PATCH the contract created automatically to add the additional data to it.
    2. POST /api/v3/users?contract=false: this will create the user without a contract. It will therefore be essential to create your contract via a POST on the contracts API.

Example of body for the creation of a new contract. Only ownerId, startsOn, typeId and establishmentId data are required.

{
   "ownerId": 89,
   "startsOn": "2022-01-19",
   "establishmentId": 1,
   "spcId": 0,
   "typeId": 1,
   "hiringTypeId": 1,
   "trialPeriodDays": 120,
   "renewedTrialPeriodDays": 240,
   "externalId": "123",
   "endsOn": "2022-02-10",
   "terminationReasonId": 27
} 

Define an end date for a contract

Two solutions (the termination reason is optional):

PATCH /directory/api/4.0/work-contracts/{workContractId} HTTPS/2
Host: example.ilucca.net
{
"endsOn":"2022-02-10",
"terminationReasonId":27
}
POST /directory/api/4.0/work-contracts/{workContractId}/termination HTTPS/2
Host: example.ilucca.net
{
"endsOn":"2022-02-10",
"terminationReasonId":27
}

Modify a work contract

PATCH /directory/api/4.0/work-contracts/{workContractId} HTTPS/2
Host: example.ilucca.net
{
"endsOn":"2022-02-10",
"terminationReasonId":27
}

Example of body (the work-contract ID can also be passed in the body and not in the URL).

{
   "startsOn":"2022-01-19",
   "establishmentId":1,
   "spcId":0,
   "typeId":1,
   "hiringTypeId":1,
   "trialPeriodDays":120,
   "renewedTrialPeriodDays":240,
   "externalId":"123",
   "endsOn":"2022-02-10",
   "terminationReasonId":27
}

Delete a work contract

Impossible if it is the employee’s last contract.

DELETE /directory/api/4.0/work-contracts/{workContractId} HTTPS/2
Host: example.ilucca.net

Configuration APIs

The following APIs allow you to retrieve the dictionnary of available values for these different contract attributes.

Work contract types

DELETE /directory/api/work-contract-types HTTPS/2
Host: example.ilucca.net

Hiring types

DELETE /directory/api/work-contract-hiring-types HTTPS/2
Host: example.ilucca.net

Work contract temporary contract grounds

DELETE /directory/api/work-contract-temporary-contract-grounds HTTPS/2
Host: example.ilucca.net

Termination reasons

DELETE /directory/api/work-contract-termination-reasons HTTPS/2
Host: example.ilucca.net

Was this page helpful?