Holidays

Holiday Object

Property Type Description Writable
id integer Unique identifier for this holiday. No
schedule_id string Schedule identifier. No
name string Holiday name. Required when creating a holiday. The maximum length is 100 characters. Yes
date string Holiday date in ISO 8601 format. Required when creating a holiday. Yes
updated_at string The date and time when this holiday was last updated, in UTC and ISO 8601 format. No
created_at string The date and time when this holiday was created, in UTC and ISO 8601 format. No

Get Holidays

GET /schedules/scheduleId/holidays

Returns all holidays of a schedule.

Parameters

Name Description
scheduleId Schedule identifier.
Optional Query Parameters
limit Number of objects to return. To return all objects, use 0. Default is 20.
offset The offset of the first record returned. Default is 0.
fields Comma delimited list of properties to be returned.
start_date When set, only holidays on this date or later will be returned. Must be in ISO 8601 format.
end_date When set, only holidays on this date or earlier will be returned. Must be in ISO 8601 format.

Example

The following request returns the id, date and name of all holidays in the year 2019:

curl "https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays?fields=date,name&start_date=2019-01-01&end_date=2019-12-31" \
-X GET \
-u user@oberplan.com:mypassword

Sample Response:

{
   "data": [
      {
         "date": "2019-01-01",
         "id": 2743,
         "name": "New Year's Day"
      },
      {
         "date": "2019-01-21",
         "id": 2744,
         "name": "Martin Luther King Jr. Day"
      },
      {
         "date": "2019-05-27",
         "id": 2745,
         "name": "Memorial Day"
      },
      {
         "date": "2019-07-04",
         "id": 2746,
         "name": "Independence Day"
      },
      {
         "date": "2019-09-02",
         "id": 2747,
         "name": "Labor Day"
      },
      {
         "date": "2019-11-11",
         "id": 2748,
         "name": "Veterans Day"
      },
      {
         "date": "2019-11-28",
         "id": 2749,
         "name": "Thanksgiving"
      },
      {
         "date": "2019-12-25",
         "id": 2750,
         "name": "Christmas Day"
      }
   ],
   "pagination": {
      "limit": 20,
      "links": {
         "first": "https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays?fields=date%2Cname&start_date=2019-01-01&end_date=2019-12-31&offset=0&limit=20",
         "last": "https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays?fields=date%2Cname&start_date=2019-01-01&end_date=2019-12-31&offset=0&limit=20"
      },
      "offset": 0,
      "page_count": 8,
      "total_count": 8
   },
   "success": true
}

Get a Holiday

GET /schedules/scheduleId/holidays/holidayId

Returns a specific holiday.

Parameters

Name Description
scheduleId Schedule identifier.
holidayId Holiday identifier.
Optional Query Parameters
fields Comma delimited list of properties to be returned.

Example

The following request returns a specific holiday:

curl https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays/2746 \
-X GET \
-u user@oberplan.com:mypassword

Sample Response:

{
   "data": {
      "created_at": "2018-08-23T13:50:35Z",
      "date": "2019-07-04",
      "id": 2746,
      "name": "Independence Day",
      "schedule_id": "akg5mf6beccwf9ce",
      "updated_at": "2018-08-23T13:50:35Z"
   },
   "success": true
}

Create a Holiday

POST /schedules/scheduleId/holidays

Creates a new holiday.

If successful, the server returns the identifier of the new holiday.

Parameters

Name Description
scheduleId Schedule identifier.

Example

The following request creates a new holiday:

curl https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays \
-X POST \
-u user@oberplan.com:mypassword \
-d \
'
{
   "name": "Independence Day",
   "date": "2020-07-04"
}
'

Sample Response:

{
    "data": [
        {
            "id": 2752
        }
    ],
    "success": true
}

Update a Holiday

PUT /schedules/scheduleId/holidays/holidayId

Updates a specific holiday.

The request body may contain all object properties or only those properties that you want to edit.

Parameters

Name Description
scheduleId Schedule identifier.
holidayId Holiday identifier.

Example

The following request changes the name of a specific holiday:

curl https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays/2755 \
-X PUT \
-u user@oberplan.com:mypassword \
-d \
'
{
   "name": "Labor Day"
}
'

Response:

{
   "success": true
}

Delete Holidays

DELETE /schedules/scheduleId/holidays

Deletes all holidays of a schedule.

You must use either the all (set to 1) or the ids query parameter to delete holidays.

Parameters

Name Description
scheduleId Schedule identifier.
Query Parameters
all When set to 1, all holidays will be deleted. Default is 0.
ids Comma delimited list of holiday identifiers. Only the associated holidays will be deleted.

Example

The following request deletes all holidays:

curl https://api.oberplan.com/v1/schedules/oydpudpjnirmlbg1/holidays?all=1 \
-X DELETE \
-u user@oberplan.com:mypassword

Response:

{
   "success": true
}

Delete a Holiday

DELETE /schedules/scheduleId/holidays/holidayId

Deletes a specific holiday.

Parameters

Name Description
scheduleId Schedule identifier.
holidayId Holiday identifier.

Example

The following request deletes a specific holiday:

curl https://api.oberplan.com/v1/schedules/akg5mf6beccwf9ce/holidays/2755 \
-X DELETE \
-u user@oberplan.com:mypassword

Response:

{
   "success": true
}