Rates Rules

  1. List rates rules
  2. Get a single rates rule
  3. Create a new rates rule
  4. Update a rates rule
  5. Destroy a rates rule

Parameters

Name Type Read/Write Description
id Integer Read Rates Rule’s id.
always_applied Boolean Read Rates Rule’s application status.
kind String Read Rates Rule’s kind. List of types described in enums section.
percentage Decimal Read Rates Rule’s percentage discount.
fixed_amount Decimal Read Rates Rule’s fixed price modifier.
period_name String Read Rates Rule’s period name.
variables Object Read Rates Rule’s variables used depending on kind type.
created_at Time Read Rates Rule’s create time.
updated_at Time Read Rates Rule’s update time.
start_date Date Read Rates Rule’s start date.
end_date Date Read Rates Rule’s end date.
Name Type Read/Write Description
id Integer Read Rates Rule’s id.
season_ids Array Write Season ids related to the rates rule.
always_applied Boolean Read/Write Rates Rule’s application status.
kind String Read/Write Rates Rule’s kind. List of types described in enums section.
percentage Decimal Read/Write Rates Rule’s percentage discount. (greater than (-100))
fixed_amount Decimal Read/Write Rates Rule’s fixed price modifier.
period_name String Read/Write Rates Rule’s period name. (50 max characters)
variables Object Read/Write Rates Rule’s variables used depending on kind type.
created_at Time Read Rates Rule’s create time.
updated_at Time Read Rates Rule’s update time.
start_date Date Read/Write Rates Rule’s start date.
end_date Date Read/Write Rates Rule’s end date.

List rates rules

List all rates rules for a given account.

GET /rates_rules

Response

{
  "links": {
    "rates_rules.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{rates_rules.rates_table}",
    "rates_rules.seasons": "https://www.bookingsync.com/api/v3/seasons/{rates_rules.seasons}"
  },
  "rates_rules": [
    {
      "id": 23,
      "always_applied": false,
      "fixed_amount": null,
      "kind": "late_booking",
      "percentage": "-20.0",
      "period_name": "Late Spring",
      "variables": {
        "days": [
          1
        ],
        "length": 5,
        "unit": "days"
      },
      "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": 12,
        "seasons": [
          1,
          19
        ]
      }
    }
  ]
}

Get a single rates rule

Returns a single rates rule identified by ID.

GET /rates_rules/:rates_rule_id

Response

{
  "links": {
    "rates_rules.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{rates_rules.rates_table}",
    "rates_rules.seasons": "https://www.bookingsync.com/api/v3/seasons/{rates_rules.seasons}"
  },
  "rates_rules": [
    {
      "id": 23,
      "always_applied": false,
      "fixed_amount": null,
      "kind": "late_booking",
      "percentage": "-20.0",
      "period_name": "Late Spring",
      "variables": {
        "days": [
          1
        ],
        "length": 5,
        "unit": "days"
      },
      "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": 12,
        "seasons": [
          1,
          19
        ]
      }
    }
  ]
}

Create a new rates rule

Creates a rates rule for given rates table.

POST /rates_tables/:rates_table_id/rates_rules

Example JSON request

{
  "rates_rules": [
    {
      "always_applied": false,
      "fixed_amount": null,
      "kind": "late_booking",
      "percentage": "-20.0",
      "period_name": "Late Spring",
      "season_ids": [
        1,
        19
      ],
      "variables": {
        "days": [
          1
        ],
        "length": 5,
        "unit": "days"
      },
      "start_date": "2017-11-16",
      "end_date": "2018-07-23"
    }
  ]
}

Response

{
  "links": {
    "rates_rules.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{rates_rules.rates_table}",
    "rates_rules.seasons": "https://www.bookingsync.com/api/v3/seasons/{rates_rules.seasons}"
  },
  "rates_rules": [
    {
      "id": 23,
      "always_applied": false,
      "fixed_amount": null,
      "kind": "late_booking",
      "percentage": "-20.0",
      "period_name": "Late Spring",
      "variables": {
        "days": [
          1
        ],
        "length": 5,
        "unit": "days"
      },
      "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": 12,
        "seasons": [
          1,
          19
        ]
      }
    }
  ]
}

Update a rates rule

Returns an updated rates rule identified by ID.

PUT /rates_rules/:rates_table_id

Example JSON request

{
  "rates_rules": [
    {
      "always_applied": false,
      "kind": "late_booking",
      "percentage": "-20.0",
      "period_name": "Late Spring",
      "season_ids": [
        1,
        19
      ],
      "variables": {
        "days": [
          1
        ],
        "length": 5,
        "unit": "days"
      },
      "start_date": "2017-11-16",
      "end_date": "2018-07-23"
    }
  ]
}

Response

{
  "links": {
    "rates_rules.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{rates_rules.rates_table}",
    "rates_rules.seasons": "https://www.bookingsync.com/api/v3/seasons/{rates_rules.seasons}"
  },
  "rates_rules": [
    {
      "id": 23,
      "always_applied": false,
      "fixed_amount": null,
      "kind": "late_booking",
      "percentage": "-20.0",
      "period_name": "Late Spring",
      "variables": {
        "days": [
          1
        ],
        "length": 5,
        "unit": "days"
      },
      "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": 12,
        "seasons": [
          1,
          19
        ]
      }
    }
  ]
}

Destroy a rates rule

Required OAuth scope: :rates_write

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

DELETE /rates_rules/:rates_table_id