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

GET /user/(user_ref)/exception

List all Working Hours Exceptions for a specific user, optionally restricted to a given time window.

The <start date> and <end date> parameters must be given in ISO 8601 format, and need to be URL-encoded where appropriate.

Sample request:

GET /user/4a1de64d6b184abfb5692d2443dfa4d2/exception?pageSize=2 HTTP/1.1
Host: api.fieldaware.net
Authorization: Token 9dcae3660ec84eac94bb506e09a9af40
Content-Type: application/json
Accept: application/json
Query Parameters:
  • sortedBy – Available sorting criteria: start, uuid

  • start – Optional filtering value for start date

  • end – Optional filtering value for end date

Sample response:

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"
    ]
}
Status Codes:

Get Working Hours Exception

GET /user/(user_ref)/exception/(exception_ref)

Retrieve a given Working Hours Exception for a specific user.

Sample request:

GET /user/4a1de64d6b184abfb5692d2443dfa4d2/exception/6f4214df45a34ab3a1664920e8505292 HTTP/1.1
Host: api.fieldaware.net
Authorization: Token 9dcae3660ec84eac94bb506e09a9af40
Content-Type: application/json
Accept: application/json

Sample response:

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
    }
  }
}
Status Codes:

Create Working Hours Exception

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:

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
    }
  }
}
Request JSON Object:
  • start (string) – ISO-formatted starting datetime (required)

  • end (string) – ISO-formatted end datetime (required)

Response JSON Object:
  • workingHours (obj) – JSON object containing the Working Hours for each day of the week.

  • workingHours.<day> (obj) – 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.

  • workingHours.(day).start (str) – start of Working Time in 24-hour format [hh]:[mm]:[ss] or [hh]:[mm].

  • workingHours.(day).end (str) – end of Working Time in 24-hour format [hh]:[mm]:[ss] or [hh]:[mm].

  • workingHours.(day).allowedOvertime (int) – minutes of allowed overtime (0-9999).

  • workingHours.(day).enabled (bool) – 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:

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"
  }
}
Status Codes:

Update Working Hours Exception

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:

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
    }
  }
}
Request JSON Object:
  • start (string) – ISO-formatted starting datetime (required)

  • end (string) – ISO-formatted end datetime (required)

Response JSON Object:
  • workingHours (obj) – see the description of the object in the payload required by the previous POST request.

Status Codes:

Delete Working Hours Exception

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:

DELETE /user/4a1de64d6b184abfb5692d2443dfa4d2/exception/379cdd559bee4eaea01edbde9ebc15e7 HTTP/1.1
Host: api.fieldaware.net
Authorization: Token 9dcae3660ec84eac94bb506e09a9af40
Content-Type: application/json
Accept: application/json
Status Codes: