Periods

  1. List periods
  2. Get a single period
  3. Create a new period
  4. Update a period
  5. Destroy a period

Parameters

Name Type Read/Write Description
id Integer Read Period’s id.
created_at Time Read Payment’s create time.
updated_at Time Read Payment’s update time.
start_date Date Read Period’s start date.
end_date Date Read Period’s end date.
Name Type Read/Write Description
id Integer Read Period’s id.
created_at Time Read Payment’s create time.
updated_at Time Read Payment’s update time.
start_date Date Read/Write Required. Period’s start date.
end_date Date Read/Write Required. Period’s end date.

List periods

List all periods for a given account.

GET /periods

Response

{
  "links": {
    "periods.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{periods.rates_table}",
    "periods.season": "https://www.bookingsync.com/api/v3/seasons/{periods.season}"
  },
  "periods": [
    {
      "id": 232,
      "created_at": "2017-11-09T09:08:17Z",
      "updated_at": "2017-11-09T09:08:17Z",
      "start_date": "2017-11-16",
      "end_date": "2018-07-23",
      "links": {
        "rates_table": 5,
        "season": 12
      }
    }
  ]
}

Get a single period

Returns a single period identified by ID.

GET /periods/:period_id

Response

{
  "links": {
    "periods.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{periods.rates_table}",
    "periods.season": "https://www.bookingsync.com/api/v3/seasons/{periods.season}"
  },
  "periods": [
    {
      "id": 232,
      "created_at": "2017-11-09T09:08:17Z",
      "updated_at": "2017-11-09T09:08:17Z",
      "start_date": "2017-11-16",
      "end_date": "2018-07-23",
      "links": {
        "rates_table": 5,
        "season": 12
      }
    }
  ]
}

Create a new period

Creates a period for given season.

POST /seasons/:season_id/periods

Example JSON request

{
  "periods": [
    {
      "start_date": "2017-11-16",
      "end_date": "2018-07-23"
    }
  ]
}

Response

{
  "links": {
    "periods.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{periods.rates_table}",
    "periods.season": "https://www.bookingsync.com/api/v3/seasons/{periods.season}"
  },
  "periods": [
    {
      "id": 232,
      "created_at": "2017-11-09T09:08:17Z",
      "updated_at": "2017-11-09T09:08:17Z",
      "start_date": "2017-11-16",
      "end_date": "2018-07-23",
      "links": {
        "rates_table": 5,
        "season": 12
      }
    }
  ]
}

Update a period

Returns an updated period identified by ID.

PUT /periods/:period_id

Example JSON request

{
  "periods": [
    {
      "start_date": "2017-11-16",
      "end_date": "2018-07-23"
    }
  ]
}

Response

{
  "links": {
    "periods.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{periods.rates_table}",
    "periods.season": "https://www.bookingsync.com/api/v3/seasons/{periods.season}"
  },
  "periods": [
    {
      "id": 232,
      "created_at": "2017-11-09T09:08:17Z",
      "updated_at": "2017-11-09T09:08:17Z",
      "start_date": "2017-11-16",
      "end_date": "2018-07-23",
      "links": {
        "rates_table": 5,
        "season": 12
      }
    }
  ]
}

Destroy a period

Required OAuth scope: :rates_write

Returns an empty response with ‘204 No Content’ status code on success.

DELETE /periods/:period_id