Introduction
This is a guide aimed at helping you achieving the synchronization of all leaves edited in Lucca Absences with a third-party app. The implementation is a regular synchronization of all leaves that have been created, deleted or modified by the users since your last synchronization attempt{lastSyncDateTime}.
This process can be done on an users business-establishment basis leavePeriod.owner.legalEntityId in order to adapt to different time zones.
About legal establishments filtering: Be careful, this filter on the establishments is applied on the current establishment of the user (at the time of the request), and not his establishment at the time of the leave creation / confirmation / deletion. You’ll get eventual consistency as long as all establishments are synchronized.
- Delete if cancellationDate is not null;
- Update or insert otherwise.
Prerequisites
You’ll need:- (required) Your domain name
{yourDomain}, eg: “https://myawesomecompany.ilucca.net”. - (required) An API key
{apiKey}that has access to the leaves of the users concerned by your integration project. This key should be created with the help of a Lucca Customer Success Manager. - (optional) When filtering on legal establishments, the unique identifiers of said establishments.
Fields
Leaves have a large number of fields. A complete list of all fields can be found in the API reference. Here are the commonly used ones:(integer) id: unique identifier of the leave.(date) date: date of the leave.(boolean) isAm: half day:truefor the morning orfalsefor the afternoon.(integer) ownerId: identifier of the user.(date-time) creationDate: time-stamp of the creation of the leave.(string) comment: comment.(date-time) cancellationDate: time-stamp of the cancellation of the leave.(date-time) leavePeriod.confirmationDate: time-stamp of the confirmation of the associated leave-period (a leave-period is a set of consecutive leaves that were requested simultaneously).
fields query parameter, which accepts a comma-separated list of field names. Example:
Paging
The leaves endpoint is paginated. Paging is handled through thepaging request parameter which takes two arguments: the index of the first element in the collection to return start (starts at zero) and the number of elements to return per page (maximum 10,000).
For example, to return 100 elements from the 15th: ?paging=14,100.
The total number of elements across all pages that meet the criteria of the query can be retrieved through the collection.count field:
collection.count field can therefore be sent to retrieve this value, and the sequence of paginated calls shall follow.
Retrieve Created & Confirmed Leaves
The parameters of the request are the following:- (required)
(int) {leavePeriod.ownerId}: bounding the request to a set of owners is required by the server, send?leavePeriod.ownerId=notequal,0to retrieve leaves of ALL users. - (required)
(date) {maxRange}: UTC date in ISO-8601 format, eg:2021-01-01. This parameter is used to avoid retrieving leaves that are too far in the past. (date-time) {lastSyncDateTime}: UTC date and time of the last synchronization in ISO-8601 format, eg:2021-01-01T08:25:45Z.(integer) {offset}: index of the first element to be returned (paging). Starts at zero.(integer) {limit}: number of elements to return (pagination). Maximum value: 10,000.- (optional)
(array<integer>) {legalEntityIds}: filter on the establishment(s) of the declarants (separated by commas). Allows to return only the time-entries of employees of one or several establishments targeted by their identifier. (array<string>) {fields}: the list of fields (see section above) separated by a comma that you want to retrieve.
Retrieve Unconfirmed Leaves
The parameters of the request are the following:- (required)
(int) {leavePeriod.ownerId}: bounding the request to a set of owners is required by the server, send?leavePeriod.ownerId=notequal,0to retrieve leaves of ALL users. - (required)
(date) {maxRange}: UTC date in ISO-8601 format, eg:2021-01-01. This parameter is used to avoid retrieving leaves that are too far in the past. (date-time) {lastSyncDateTime}: UTC date and time of the last synchronization in ISO-8601 format, eg:2021-01-01T08:25:45Z.(integer) {offset}: index of the first element to be returned (paging). Starts at zero.(integer) {limit}: number of elements to return (pagination). Maximum value: 10,000.- (optional)
(array<integer>) {legalEntityIds}: filter on the establishment(s) of the declarants (separated by commas). Allows to return only the leaves of employees of one or several establishments targeted by their identifier. (array<string>) {fields}: the list of fields (see section above) separated by a comma that you want to retrieve.(bool) leavePeriod.isconfirmed: set tofalseto retrieve only unconfirmed leaves.
Retrieve Deleted (i.e. Cancelled) Leaves
The parameters of the request are the following:- (required)
(int) {leavePeriod.ownerId}: bounding the request to a set of owners is required by the server, send?leavePeriod.ownerId=notequal,0to retrieve leaves of ALL users. - (required)
(date) {maxRange}: UTC date in ISO-8601 format, eg:2021-01-01. This parameter is used to avoid retrieving leaves that are too far in the past. (date-time) {lastSyncDateTime}: UTC date and time of the last synchronization in ISO-8601 format, eg:2021-01-01T08:25:45Z.(integer) {offset}: index of the first element to be returned (paging). Starts at zero.(integer) {limit}: number of elements to return (pagination). Maximum value: 10,000.- (optional)
(array<integer>) {legalEntityIds}: filter on the establishment(s) of the declarants (separated by commas). Allows to return only the leaves of users of one or several establishments targeted by their identifier. (array<string>) {fields}: the list of fields (see section above) separated by a comma that you want to retrieve.