Working Hours Exceptions ------------------------ This API allows listing and retrieving Working Hours Exceptions for a specific user. Working Hours Exceptions are identified by their UUID. List Working Hours Exceptions ............................. .. http:get:: /user/(user_ref)/exception List all Working Hours Exceptions for a specific user, optionally restricted to a given time window. The ** and ** parameters must be given in ISO 8601 format, and need to be URL-encoded where appropriate. **Sample request**: .. sourcecode:: http GET /user/4a1de64d6b184abfb5692d2443dfa4d2/exception?pageSize=2 HTTP/1.1 Host: api.fieldaware.net Authorization: Token 9dcae3660ec84eac94bb506e09a9af40 Content-Type: application/json Accept: application/json :query sortedBy: Available sorting criteria: ``start``, ``uuid`` :query start: Optional filtering value for ``start`` date :query end: Optional filtering value for ``end`` date **Sample response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "count": 5, "items": [ { "uuid": "6f4214df45a34ab3a1664920e8505292", "start": "2019-03-20T00:00:00+00:00", "end": "2019-04-20T00:00:00+00:00", "link": { "url": "https://api.fieldaware.net/user/3ba7cb22827241bd98f816c9af58ebb0/exception/6f4214df45a34ab3a1664920e8505292", "rel": "detail" } }, { "uuid": "8b2e54a163bd40618e2d80cf7870c09b", "start": "2019-05-25T00:00:00+00:00", "end": "2019-05-28T00:00:00+00:00", "link": { "url": "https://api.fieldaware.net/user/3ba7cb22827241bd98f816c9af58ebb0/exception/6f4214df45a34ab3a1664920e8505292", "rel": "detail" } } ], "page": 0, "pageSize": 2, "sortedBy": [ "start", "uuid" ] } :statuscode 200: resources retrieved successfully :statuscode 422: validation error Get Working Hours Exception ........................... .. http:get:: /user/(user_ref)/exception/(exception_ref) Retrieve a given Working Hours Exception for a specific user. **Sample request**: .. sourcecode:: http GET /user/4a1de64d6b184abfb5692d2443dfa4d2/exception/6f4214df45a34ab3a1664920e8505292 HTTP/1.1 Host: api.fieldaware.net Authorization: Token 9dcae3660ec84eac94bb506e09a9af40 Content-Type: application/json Accept: application/json **Sample response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "uuid": "6f4214df45a34ab3a1664920e8505292", "start": "2019-03-20T00:00:00+00:00", "end": "2019-04-20T00:00:00+00:00", "workingHours": { "monday": { "start": "09:00:00", "end": "17:00:00", "allowedOvertime": 60, "enabled": true }, "tuesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "wednesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "thursday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "friday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "saturday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false }, "sunday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false } } } :statuscode 200: resource retrieved successfully :statuscode 404: resource not found Create Working Hours Exception .............................. .. http:post:: /user/(user_ref)/exception Create a new Working Hours Exception for a specific user. The following restrictions apply: - It is not possible to have more than one Working Hours Exceptions with the same start and end date for the same user. - Full working hours for the entire week must be supplied, including inner attributes, even if the exception covers a period of less than a week. - Overtime from one day cannot overlap with start of the working hours for the following day. - Exceptions cover dates only, any times sent to the API will be truncated to ``T00:00:00+00:00`` - If the API user's organisation is Enterprise-enabled, the API user cannot create a Working Hours Exception for users in other branches in which the API user does not have full access. **Sample request**: .. sourcecode:: http POST /user/4a1de64d6b184abfb5692d2443dfa4d2/exception HTTP/1.1 Host: api.fieldaware.net Authorization: Token 9dcae3660ec84eac94bb506e09a9af40 Content-Type: application/json Accept: application/json { "start": "2019-03-20T00:00:00+00:00", "end": "2019-04-20T00:00:00+00:00", "workingHours": { "monday": { "start": "09:00:00", "end": "17:00:00", "allowedOvertime": 60, "enabled": true }, "tuesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "wednesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "thursday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "friday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "saturday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false }, "sunday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false } } } :json obj workingHours: JSON object containing the Working Hours for each day of the week. :>json obj workingHours.: JSON object identifying the Working Hours for a specific day of the week. Day can be one of ``monday``, ``tuesday``, ``wednesday``, ``thursday``, ``friday``, ``saturday``, ``sunday``. :>json str workingHours.(day).start: start of Working Time in 24-hour format [hh]:[mm]:[ss] or [hh]:[mm]. :>json str workingHours.(day).end: end of Working Time in 24-hour format [hh]:[mm]:[ss] or [hh]:[mm]. :>json int workingHours.(day).allowedOvertime: minutes of allowed overtime (0-9999). :>json bool workingHours.(day).enabled: ``true`` if the day is enabled, ``false`` if disabled. .. note:: If ``end`` is less than or equal to ``start``, then it's considered to be in the following day. **Sample response**: .. sourcecode:: http HTTP/1.1 201 CREATED { "uuid": "6f4214df45a34ab3a1664920e8505292", "start": "2019-03-20T00:00:00+00:00", "end": "2019-04-20T00:00:00+00:00", "workingHours": { "monday": { "start": "09:00:00", "end": "17:00:00", "allowedOvertime": 60, "enabled": true }, "tuesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "wednesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "thursday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "friday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "saturday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false }, "sunday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false } }, "link": { "url": "https://api.fieldaware.net/user/3ba7cb22827241bd98f816c9af58ebb0/exception/6f4214df45a34ab3a1664920e8505292", "rel": "detail" } } :statuscode 201: created successfully :statuscode 409: conflict error :statuscode 422: validation error Update Working Hours Exception .............................. .. http:put:: /user/(user_ref)/exception/(exception_ref) Update an existing Working Hours Exception for a specific user. All fields are optional, and only the specified fields will be updated. If start and/or end is included for update, then both must be included. The following restrictions apply: - It is not possible to have more than one Working Hours Exceptions with the same start and end date for the same user. - Overtime from one day cannot overlap with start of the working hours for the following day. - Exceptions cover dates only, any times sent to the API will be truncated to ``T00:00:00+00:00`` - If the API user's organisation is Enterprise-enabled, the API user cannot create a Working Hours Exception for users in other branches the API user does not have full access to. **Sample request**: .. sourcecode:: http PUT /user/4a1de64d6b184abfb5692d2443dfa4d2/exception/379cdd559bee4eaea01edbde9ebc15e7 HTTP/1.1 Host: api.fieldaware.net Authorization: Token 9dcae3660ec84eac94bb506e09a9af40 Content-Type: application/json Accept: application/json { "start": "2019-03-20T00:00:00+00:00", "end": "2019-04-20T00:00:00+00:00", "workingHours": { "monday": { "start": "09:00:00", "end": "17:00:00", "allowedOvertime": 60, "enabled": true }, "tuesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "wednesday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "thursday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "friday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": true }, "saturday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false }, "sunday": { "start": "08:00:00", "end": "17:00:00", "allowedOvertime": 0, "enabled": false } } } :json obj workingHours: see the description of the object in the payload required by the previous POST request. :statuscode 204: resource updated successfully :statuscode 404: resource not found :statuscode 409: conflict error :statuscode 422: validation error Delete Working Hours Exception .............................. .. http:delete:: /user/(user_ref)/exception/(exception_ref) Delete an existing Working Hours Exception for a specific user. The following restriction applies: - For Enterprise-enabled Organisations, it is not possible to delete a Working Hours Exception for users in branches the API user does not have full access to. **Sample request**: .. sourcecode:: http DELETE /user/4a1de64d6b184abfb5692d2443dfa4d2/exception/379cdd559bee4eaea01edbde9ebc15e7 HTTP/1.1 Host: api.fieldaware.net Authorization: Token 9dcae3660ec84eac94bb506e09a9af40 Content-Type: application/json Accept: application/json :statuscode 204: resource deleted successfully :statuscode 404: resource not found