Periods

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

Overview

This resource represents Periods which define the timeline for applicability of the Seasons.

Parameters

Name Type Read/Write Description
account Integer Read Account’s ID related to the Period
season Integer Read Season’s ID related to the Period
rates_table Integer Read Rates Table’s ID related to the Period
id Integer Read Period’s id.
created_at Time Read Period’s create time.
updated_at Time Read Period’s update time.
start_date Date Read Period’s start date.
end_date Date Read Period’s end date.
archived_at Time Read Period’s archived time.
Name Type Read/Write Description Constraints
account Integer Read Account’s ID related to the Period  
season Integer Read Season’s ID related to the Period  
rates_table Integer Read Rates Table’s ID related to the Period  
id Integer Read Period’s id.  
created_at Time Read Period’s create time.  
updated_at Time Read Period’s update time.  
start_date Date Read/Write Period’s start date. Required, must be before end_date
end_date Date Read/Write Period’s end date. Required, must be after start_date, the maximum allowed value is 3 years from the current date
archived_at Time Read Period’s archived time.  

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": "2022-03-23T16:56:20Z",
      "updated_at": "2022-03-23T16:56:20Z",
      "start_date": "2022-03-30",
      "end_date": "2022-12-04",
      "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": "2022-03-23T16:56:20Z",
      "updated_at": "2022-03-23T16:56:20Z",
      "start_date": "2022-03-30",
      "end_date": "2022-12-04",
      "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": "2022-03-30",
      "end_date": "2022-12-04"
    }
  ]
}

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": "2022-03-23T16:56:20Z",
      "updated_at": "2022-03-23T16:56:20Z",
      "start_date": "2022-03-30",
      "end_date": "2022-12-04",
      "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": "2022-03-30",
      "end_date": "2022-12-04"
    }
  ]
}

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": "2022-03-23T16:56:20Z",
      "updated_at": "2022-03-23T16:56:20Z",
      "start_date": "2022-03-30",
      "end_date": "2022-12-04",
      "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