Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor
topOfPage
topOfPage
The Time Off API is used to access, create, and modify the periods of time off taken on your business' account. The Time Off API is connected to the Staff API, as periods of time off are taken by and only apply to staff, whereas the Vacations API is used to close a location for a company-wide period of time off.




Info
titleOn this page

Table of Contents





Time Off API Endpoints


These are the endpoints that are available under the /timeOff path, which shows what hours your staff has taken off. Please note that to create new periods of time off, you POST to the /timeOffBulk path, and also note that you can view multiple time offs by simply posting a GET call to the /appointments/report path with the excludeTimeOff parameter set to false and the onlyTimeOff parameter set to 1. For more information about GET /appointments/report calls, please refer to the Appointments API page.

Endpoint

Description

GET /appointments/report

Returns all appointment objects on an account in array format. To get time offs to return, set the excludeTimeOff parameter to false and set the onlyTimeOff parameter to 1.

GET /timeOff/{timeOffId}Returns a JSON object for specified time off.
POST /timeOffBulk

Creates a new timeOff object on an' account.

Request body/payload: Must pass a full timeOff object.

For these calls, you need to pass a timeOff object with all required fields and any fields you want to set filled in the body of the payload. We have an example of a timeOff object in the responses section below and have indicated the required fields in the object values table at the bottom of this page.

PUT /timeOff/{timeOffId}

Updates an existing time off object.

Request body/payload: Must pass a timeOff object with the desired changes made.

For these calls, you need to pass a timeOff object with all required fields and any fields you want to update filled in the body of the payload. We have an example of a timeOff object in the responses section below and have indicated the required fields in the object values table at the bottom of this page.

DELETE /timeOff/{timeOffId}

Removes a timeOff object from view by setting its active property to false.





Time Off API Parameters

There are no parameters included with time off calls.

How to Get List of Time Offs

The timeOff object is just a stripped down version of the appointment object, as both are representative of events on a staff member's schedule. The timeOffId is generally interchangeable with the calendarId in the appointments API documentation. There is no dedicated endpoint to get a list of timeOff objects, but because of the relationship between time offs and appointments, you can use the appointments endpoint GET appointments/report to retrieve a list of time offs. The three things you would need to make sure of before trying to do this are:
  1. You set the parameter onlyTimeOff to 1
  2. The parameter excludeTimeOff is set to false
  3. the serviceIdList parameter is either sent in as null or only includes ids for reasons that are of reasonType PERSONAL




Time Off API

Responses

Request Body/Payloads


The objects below represent the minimum viable objects to pass that are needed to create or update a timeOff object. Check whether or not a property can be written to by looking at the Object Values table below to see if the property is writable.

Code Block
languagejs
titlePOST /timeOffBulk
linenumberstrue
collapsetrue
{
    "businessId": "43111",
    "endDate": "2019-02-13",
    "endTime": "1400",
    "reason": {Reason object for reason of time off - for more info, see Services API page},
    "repeats": false,
    "staffId": [80891],
    "startDate": "2019-02-13",
    "startTime": "1300"
}


Code Block
languagejs
titleGET PUT /timeOff/{timeOffId}
linenumberstrue
collapsetrue
{
    "businessId": 43111,
    "color": null,
    "createdDate": "20182019-0802-0311 1417:3927:3808",
    "createdUser": "JoeSchmo",
    "description": "NeedBabysitter agot break!sick",
    "endDate": "20182019-1002-0113",
    "endTime": 1200"1400",
    "modifiedDate": "20182019-0802-0711 1517:1027:2708",
    "modifiedUser": "JoeSchmo",
    "note": "Babysitter got sick",
    "reason": {Reason object for reason of time off - for more info, see servicesServices API page},
    "recurringAppointmentId": null,
    "staff": {Staff object for staff withof time off - for more info, see staffStaff API page},
    "staffId": 80891,
    "startDate": "20182019-1002-0113",
    "startTime": 1100"1300",
    "status": "OpenOPEN",
    "timeOffId": 1736094720050788
}





Time Off API Responses


Code Block
languagejs
titlePOST /timeOffBulkGET /timeOff/{timeOffId}
linenumberstrue
collapsetrue
[{
    "allDay": true,
    "businessId": 43111,
    "color": null,
    "createdDate": "2018-08-03 2114:39:38",
    "createdUser": "JoeSchmo",
    "description": "Need an even longera break!",
    "endDate": "2018-10-01",
    "endTime": "1400"1200,
    "modifiedDate": "2018-08-07 1115:3410:5627",
    "modifiedUser": "JoeSchmo",
    "originalStartDate": "2018-10-01",
    "reason": {Reason object for reason of time off-see services API page},
    "recurringAppointmentId": null,
    "staff": {Staff object for staff with time off-see staff API page},
    "staffId": 80891,
    "startDate": "2018-10-01",
    "startTime": "1100",
    "status": "1100Open",
    "timeOffId": 17360947
}}]


Code Block
languagejs
titlePUT /timeOff/{timeOffId}POST /timeOffBulk
linenumberstrue
collapsetrue
[{
    "allDay": true,
    "businessId": 43111,
    "color": null,
    "createdDate": "2018-08-03 1421:39:38",
    "createdUser": "JoeSchmo",
    "description": "Need an aeven longer break!",
    "endDate": "2018-10-01",
    "endTime": "1400",
    "modifiedDate": "2018-08-07 11:34:56",
    "modifiedUser": "JoeSchmo",
    "originalStartDate": "2018-10-01",
    "reason": {Reason object for reason of time off-see services API page},
    "recurringAppointmentId": null,
    "staff": {Staff object for staff with time off-see staff API page},
    "staffId": 80891,
    "startDate": "2018-10-01",
    "startTime": "1100",
    "status": "1100",
    "timeOffId": 17360947
}
  • For the appointments report endpoint, please refer to the Appointments API page.

Time Off API Request Body/Payloads

}]


Code Block
languagejs
titlePOST /timeOffBulkPUT /timeOff/{timeOffId}
linenumberstrue
collapsetrue
{
    "businessIdallDay": "43111",
    "endDate": "2019-02-13",
    "endTime": "1400",
    "reason": {Reason object for reason of time off - for more info, see Services API page}true,
    "repeats": false,
    "staffId": [80891],
    "startDate": "2019-02-13",
    "startTime": "1300"
}
Code Block
languagejs
titlePUT /timeOff/{timeOffId}
linenumberstrue
collapsetrue
{
    "businessId": 43111,
    "color": null,
    "createdDate": "20192018-0208-1103 1714:2739:0838",
    "createdUser": "JoeSchmo",
    "description": "BabysitterNeed a gotlonger sickbreak!",
    "endDate": "20192018-0210-1301",
    "endTime": "1400",
    "modifiedDate": "20192018-0208-07 11 17:2734:0856",
    "modifiedUser": "JoeSchmo",
    "noteoriginalStartDate": "Babysitter got sick2018-10-01",
    "reason": {Reason object for reason of time off - for more info, see Servicesservices API page},
    "recurringAppointmentId": null,
    "staff": {Staff object for staff ofwith time off - for more info, see Staffstaff API page},
    "staffId": 80891,
    "startDate": "20192018-0210-1301",
    "startTime": "13001100",
    "status": "OPEN1100",
    "timeOffId": 2005078817360947
}
  • For the appointments report endpoint, please refer to the Appointments API page.




Time Off Object Values


Property nameTypeRequiredWritableDescription
businessIdintegerYes
Provides unique numeric ID of the business offering specified time off.
colorstring
YesDisplays any color chosen to override specified time off on the backoffice calendar.
createdDatestring

Displays as date specified time off was created as YYYY-MM-DD with time after. 

createdUserstring

Displays the username of user who created specified time off. 
descriptionstring
YesDisplays any description that was added to time off profile.
endDatestringYesYesProvides the date that specified time off is set to end as YYYY-MM-DD. 
endTimeintegerYesYesProvides the time that specified time off ends displayed in military format. 
modifiedDatestring

Displays as date specified time off was last modified as YYYY-MM-DD with time after.
modifiedUserstring

Displays the username of user who last modified specified time off.
reasonobjectYesYesDisplays the reason object connected to specified time off - for more info, see Services API page. 
recurringAppointmentIdinteger

If specified time off is part of a repeating time off series, then this provides unique numeric ID of that series.
staffobjectYesYesDisplays the staff object connected to specified time off - for more info, see Staff API page.
startDatestringYesYesProvides the date that specified time off is set to begin as YYYY-MM-DD.
startTimeintegerYesYesProvides the time that specified time off is set to begin displayed in military format. 
statusstringYesYesDisplays the status of time off. Possible values include Open, Closed, or Cancelled. 
timeOffIdintegerYes, on PUT calls
Provides unique numeric ID of specified time off.