Introduction

Delegation consists of choosing a someone to delegate to and the delegation period :

  • only during manager’s holidays, this is the default strategy
  • permanently, if I never have time to validate the requests of my collaborators
  • from date to date, for a one-off delegation not related to my holidays

Here are the properties of the delegation resource:

  • Owner: the one who delegates
  • Delegatee: the user targeted by the delegation, the one to whom we delegate
  • StartsOn: for a date-to-date delegation, the start date (included)
  • EndsOn: for a date-to-date delegation, the end date (inclusive)
  • OnlyDuringHolidays: Boolean that allows you to indicate that you only want to delegate during your holidays & absences
  • IsActive: indicates the state of the delegation, allows if necessary to temporarily deactivate the delegation without losing its information (delegate, strategy)

NB: The delegation does not have a unique ID, so it is a resource available under the ‘users’ resource.

Retrieve the delegation of the current user

You can retrieve delegation information via the following API.

GET api/v3/users/me/delegation
{
    "delegateeId": 33,
    "delegatee": {
        "id": 33,
        "name": "John Doe"
    },
    "startsOn": null,
    "endsOn": null,
    "isActive": true,
    "onlyDuringHolidays": true
}

Modify the user’s delegate

Here we assign user (id=34) as the delegate of user (id=123) with the same previous period of delegation.

PUT /api/v3/users/123/delegation HTTPS/2
Host: example.ilucca.net
Content-Type: application/json

{
    "delegatee": {
        "id": 34
    }
}

Modify delegation period

In order to swith the period from “during holidays” to a date to date period, you need to deactivate the first strategy and indicate the period.

PUT /api/v3/users/123/delegation HTTPS/2
Host: example.ilucca.net
Content-Type: application/json

{
    "onlyDuringHolidays": false,
    "startsOn": "2016-01-01",
    "endsOn": "2016-12-31"
}

For a permanent delegation, set startsOn and endsOn to NULL. You can also set only the startsDate so that the permanent delegation strarts from a specific date.

Deactivate delegation

To cancel or deactivate temporarily the delegation, change the activation status.

PUT /api/v3/users/123/delegation HTTPS/2
Host: example.ilucca.net
Content-Type: application/json

{
    "isActive": false
}

Do the opposite to reactivate it.