Skip to content

Latest commit

 

History

History
111 lines (90 loc) · 3.77 KB

File metadata and controls

111 lines (90 loc) · 3.77 KB
title Resource Exception Dates
nav_order 7

Opening hours for a resource is what is used to generate available slots for a service. It is based on the default opening hours on the resource unless anything else is specified by a resource exception date. So ignore the poor naming of the feature and treat it as opening hours on dates. If a resource should be closed for a week then you would add resource exception dates. If a resource should have opening hours 08:00 to 14:00 on January 5th 2016 instead of the default opening hours for that weekday which could be 09:00 to 15:00, then add it as a resource exception date. See resource opening hours for how to specify.

A null value will fallback to the default availability for the resource. An empty array means the resource is closed on the specified exception date.

Exception dates are related to a resource: GET /resources/{resource_id}/exception_dates.

Attributes

NameTypeDescription
created_atDatetimeAutomatically set
updated_atDatetimeAutomatically set
resource_idIntegerRequired (specified in URL)
exception_dateDateRequired (specified in URL)
opening_hoursArraySame format as resource opening hours
service_idInteger

Listing

GET /resources/{resource_id}/exception_dates will return all exception dates for resource with id {resource_id}.

Response

[
  {
    "resource_exception_date": {
      "created_at": "2012-09-20T15:34:16+02:00",
      "resource_id": 1,
      "exception_date": "2014-01-08",
      "opening_hours": ["08:00", "12:00", "12:30", "17:30"],
      "updated_at": "2012-09-20T15:34:16+02:00"
    }
  }
]

Query Parameters

NameTypeDescription
fromDate
toDate

Get exception date

GET /resources/{resource_id}/exception_dates/{exception_date} will get the exception date {exception_date} for resource {resource_id}. If no existing entry is found a 404 HTTP status code is returned. In that case standard opening hours apply.

Add new or update exception date

POST /resources/{resource_id}/exception_dates/{exception_date} will create a new or update an existing exception date {exception_date} for resource {resource_id}. You can also use PUT, both methods works the same way regardless if it is a new entry or an update to an existing one.

Add new or update multiple exception dates

POST /resources/{resource_id}/exception_dates/ will create new or update existing exception dates for resource {resource_id}. You can also use PUT, both methods works the same way regardless if it is a new entry or an update to an existing one.

To delete an existing exception date set {_destroy} to be true.

{
  "resource_exception_dates": [
    {
      "exception_date": "2015-10-22",
      "opening_hours": [
      "12:00",
      "14:30"
      ]
    },
    {
      "exception_date": "2015-10-25",
      "opening_hours": [
      "08:30",
      "12:30",
      "15:00",
      "18:30"
      ]
    },
    {
      "exception_date": "2015-10-26",
      "opening_hours": [
      "10:30",
      "15:00"
      ]
    },
    {
      "exception_date": "2015-10-27",
      "opening_hours": null
    },
    {
      "exception_date": "2015-10-28",
      "_destroy": true
    }
  ]
}

Delete exception date

DELETE /resources/{resource_id}/exception_dates/{exception_date} will delete existing exception date {exception_date} for resource {resource_id}.