All access to the API require authentication (see Authentication)

Purpose of leave

 A leave is an object which indicates when it is present, for a user (owner) and for a day or a half-day that the employee has taken leave.

The following example:


{
    "owner": {
        "displayName": "François Bigeot"},
        "date": "2015-07-07T00:00:00",
        "leaveScope": "PM",
        "lastModified": "2015-02-05T12:15:34",
        "accountCode": 4515,
        "status": 0
    }
}

The example shows that François Bigeot has taken leave on the afternoon of July 8, 2015. If he had also taken leave in the morning on the same counter, the PM would be replaced by ALL. If  the leave had been taken on another counter or on the occasion of another request, an additional leave would be produced only for AM.

 

Leave for a specific employee or department

To retrieve the leave of a particular employee, you can add a filter such as:

https://{instance}/api/leaves?date=between,2015-07-01,2015-08-31&fields=owner.name,owner.login,owner.mail,owner.matricule,name,date,status&owner.id=344

If you do not know the usernames of your employees, you must make a first request to the concerned API, for example, if you know the email address:

https://{instance}/api/users?mail={XXX}

Similarly, if you want to retrieve the leave of a particular department, you must first retrieve its ID:

https://{instance}/api/departments

Then you can complete the following request:

https://{instance}/api/leaves?date=between,2015-07-01,2015-08-31&fields=owner.name,owner.login,owner.mail,owner.matricule,name,date,status&department.id=1

 

Follow the progression of leave

INITIALIZATION

First, an initialization is required to obtain the leave record during the concerning period for the concerning users.

Example of an initial request concerning a single user made February 5, 2015 at 12:30 pm.

https://{instance}/api/leaves?fields=leaveScope,status,owner.displayName,date,lastModified,accountCode&date=between,2015-07-01,2015-07-31&owner.id=393

[
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "date": "2015-07-07T12:00:00",
        "leaveScope": "PM",
        "lastModified": "2015-02-05T12:15:46",
        "accountCode": 4515,
        "status": 0
    },
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "date": "2015-07-07T00:00:00",
        "leaveScope": "AM",
        "lastModified": "2015-02-05T12:15:34",
        "accountCode": 4515,
        "status": 0
    },
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "date": "2015-07-06T00:00:00",
        "leaveScope": "ALL",
        "lastModified": "2015-02-05T12:16:09",
        "accountCode": 4115,
        "status": 1
    },
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "leaveScope": "ALL",
        "date": "2015-07-08T00:00:00",
        "lastModified": "2015-02-05T12:15:56",
        "accountCode": 4712,
        "status": 0
    }
]

It can be seen that the days of the 6th, 7th and 8th have been fixed with approval or pending statutes.

DIFFERENTIAL MONITORING

Once the initial leaves are in your possession, you can follow their progression by systematically launching three requests:

  1. one for cancellations and denials
  2. one for corrections
  3. one for new leaves (temporary or approved)

Please note, the date of the last request must be recorded because it will be used (via the modified field) for the following request in order to limit the results of the entries produced since the last request.

Another note: the scope of an entry can be a half-day or an entire day but is not necessarily that of the previous entry acquired via the API for the same dates. Indeed, a leave can be taken for a day, with then only one corrected day.

1. Cancellations and denials

https://{instance}/api/leaves?fields=leaveScope,owner.displayName,date,lastModified&date=between,2015-07-01,2015-07-31&owner.id=393&modifiedOn=since,2015-02-05T12:20:00&status=3,4

[
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "date": "2015-07-07T12:00:00",
        "leaveScope": "PM",
        "lastModified": "2015-02-05T13:55:01"
    },
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "date": "2015-07-07T00:00:00",
        "leaveScope": "AM",
        "lastModified": "2015-02-05T13:54:17.063"
    }
]

It can be seen that the day of the 7th was cancelled or denied.

2. Corrections

https://{instance}/api/leaves?fields=leaveScope,owner.displayName,date,lastModified&date=between,2015-07-01,2015-07-31&owner.id=393&modifiedOn=since,2015-02-05T12:20:00&debit=until,0


[
    {
        "owner": {
            "displayName": "François Bigeot"
        },
        "date": "2015-07-06T00:00:00",
        "leaveScope": "ALL",
        "lastModified": "2015-02-05T13:54:34.03"
    }
]

It can be seen that the day of the 8th was cancelled due to a correction.

3. New leaves

https://{instance}/api/leaves?fields=leaveScope,status,owner.displayName,date,lastModified&date=between,2015-07-01,2015-07-31&owner.id=393&modifiedOn=since,2015-02-05T12:20:00


[
    {
        "owner": {
            "displayName": "François Bigeot"},
        "date": "2015-07-08T00:00:00",
        "leaveScope": "AM",
        "lastModified": "2015-02-05T13:55:42",
        "status": 1
    }
]

Finally, t can be seen that a new leave was request on the morning of the 8th.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments