Availability and Rates

API methods to work with Availability and Rates information

Availability and Restrictions information is core data of Channex.io. This information represent how many rooms your property have to sell and what restrictions you are apply to each rate plan.

NOTE: At Channex.io availability information represented at two levels: for Rate Plan and for Room Type. At Rate Plan we are provide availability for specific Rate Plan, this value derived from Room Type Availability. At Room Type we are provide real availability without any additional restriction effects.

Get Availability Or Restrictions Per Rate Plan

Get Availability or / and Restrictions for Rate Plans.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/restrictions?filter[property_id]=716305c4-561a-4561-a187-7f5b8aeb5920&filter[date][gte]=2019-02-01&filter[date][lte]=2019-02-10&filter[restrictions]=rate

Query require two get arguments:

date Specific date or Date range what you would like to load. Date should be provided as ISO 8601 format YYYY-MM-DD. Query to get values for specific date: filter[date]=YYYY-MM-DD To get values for Date Range: filter[date][gte]=YYYY-MM-DD&filter[date][lte]=YYYY-MM-DD

restrictions List of comma separated restrictions what you would like to load. Supported values: - availability - rate - min_stay_arrival - closed_to_arrival - closed_to_departure - stop_sell - max_stay - availability_offset - max_sell - max_availability

Success Response Example

Status Code: 200 OK

{
"data": {
"bab451e7-9ab1-4cc4-aa16-107bf7bbabb2": {
"2019-02-01": {
"rate": "200.00"
},
"2019-02-02": {
"rate": "200.00"
},
"2019-02-03": {
"rate": "200.00"
},
"2019-02-04": {
"rate": "200.00"
},
"2019-02-05": {
"rate": "200.00"
},
"2019-02-06": {
"rate": "200.00"
},
"2019-02-07": {
"rate": "200.00"
},
"2019-02-08": {
"rate": "200.00"
},
"2019-02-09": {
"rate": "200.00"
},
"2019-02-10": {
"rate": "200.00"
}
}
}
}
‚Äč

Bad Request Error Response

Status Code: 400 Bad Request

{
"errors": {
"code": "bad_request",
"title": "Bad Request",
"details": [
"restrictions is required"
]
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Restriction object in the answer.

Bad Request Error Method can return a Bad Request Error result with 400 Bad Request HTTP Code if user pass wrong arguments.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Restriction Object

Restriction Object is valid answer for Get Restrictions method. This object contain information about availability and restrictions. Each key at this object is equal to Rate Plan id. Each Rate Plan ID represented as Object with dates as keys. Each date represented as object where keys is restrictions and values is restriction values for specific date.

{
[RATE_PLAN_ID]: {
[DATE_YYYY-MM-DD]: {
[RESTRICTION]: [VALUE]
}
}
}

Get Availability Per Room Type

Get Real Availability per Room Type

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/availability?filter[date][gte]=2019-02-01&filter[date][lte]=2019-02-10

Query require one get arguments:

date Specific date or Date range what you would like to load. Date should be provided as ISO 8601 format YYYY-MM-DD. Query to get values for specific date: filter[date]=YYYY-MM-DD To get values for Date Range: filter[date][gte]=YYYY-MM-DD&filter[date][lte]=YYYY-MM-DD

Success Response Example

Status Code: 200 OK

{
"data": {
"994d1375-dbbd-4072-8724-b2ab32ce781b": {
"2019-02-01": 20,
"2019-02-02": 20,
"2019-02-03": 20,
"2019-02-04": 20,
"2019-02-05": 20,
"2019-02-06": 20,
"2019-02-07": 20,
"2019-02-08": 20,
"2019-02-09": 20,
"2019-02-10": 20
}
}
}

Bad Request Error Response

Status Code: 400 Bad Request

{
"errors": {
"code": "bad_request",
"title": "Bad Request",
"details": [
"date is required"
]
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Availability object in the answer.

Bad Request Error Method can return a Bad Request Error result with 400 Bad Request HTTP Code if user pass wrong arguments.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Availability Object

Availability Object is valid answer for Get Availability method. This object contain information about availability per Room Type. Each key at this object is equal to Room Type ID. Each Room Type ID represented as Object with dates as keys. Each date have a value equal to current Availability.

{
[ROOM_TYPE_ID]: {
[DATE_YYYY-MM-DD]: [AVAILABILITY]
}
}

Update Rate & Restrictions

Update Rate & Restrictions for specific Rate Plan and Date.

Request
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/restrictions

Query body (JSON):

{
"values": [{
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"rate_plan_id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"date": "2019-02-20",
"rate": 30000
}]
}

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Success"
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Fields

Query object should contain values key with list of change objects. Each change object should have next structure:

property_id [required] String with valid UUID of Property object.

rate_plan_id [required] String with valid UUID of Rate Plan object.

date [required] String with date in ISO 8601 format by mask YYYY-MM-DD.

rate [optional] String or Positive Integer value. Note: at least one restriction field is required.

min_stay_arrival [optional] Positive Integer value. Note: at least one restriction field is required.

max_stay [optional] Non-negative Integer value. Note: at least one restriction field is required.

closed_to_arrival [optional] Boolean value. Note: at least one restriction field is required.

closed_to_departure [optional] Boolean value. Note: at least one restriction field is required.

stop_sell [optional] Boolean value. Note: at least one restriction field is required.

max_sell [optional] Null or non-negative integer value. Note: at least one restriction field is required.

max_availability [optional] Null or non-negative integer value. Note: at least one restriction field is required.

availability_offset [optional] Non-negative integer value. Note: at least one restriction field is required.

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a meta object with message in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Update Availability

Update Availability for specific Room Type and Date.

Request
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/availability

Query body (JSON):

{
"values": [{
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"date": "2019-02-20",
"availability": 2
}]
}

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Success"
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Fields

Query object should contain values key with list of change objects. Each change object should have next structure:

property_id [required] String with valid UUID of Property object.

room_type_id [required] String with valid UUID of Room Type object.

date [required] String with date in ISO 8601 format by mask YYYY-MM-DD.

availability [required] Non-negative Integer value.

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a meta object with message in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Get Availability Or Restrictions Changes

Get Availability or / and Restrictions changes for Rate Plans.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/restrictions/changes?timestamp=2019-05-06T10:00:00&filter[property_id]=716305c4-561a-4561-a187-7f5b8aeb5920&filter[date][gte]=2019-02-01&filter[date][lte]=2019-02-10&filter[restrictions]=rate

Query require three get arguments:

timestamp Last check timestamp. Can be a valid ISO 8601 date time string or UNIX timestamp. Channex.io will return changes happened after that date.

property_id Property ID what changes are you like to get.

restrictions List of comma separated restrictions what you would like to load. Supported values: - availability - rate - min_stay_arrival - closed_to_arrival - closed_to_departure - stop_sell - max_stay - availability_offset - max_sell - max_availability

As optional argument, you can pass date filter to fetch changes for specific date or date range.

Success Response Example

Status Code: 200 OK

{
"data": [
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "445835fb-7956-42ac-9efc-3e6f331f0808",
"rate": 17600,
"date": "2019-05-07"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "445835fb-7956-42ac-9efc-3e6f331f0808",
"rate": 17600,
"date": "2019-05-08"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "5824ae4b-0cdd-441b-a01f-647177b48120",
"rate": 16600,
"date": "2019-05-07"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "5824ae4b-0cdd-441b-a01f-647177b48120",
"rate": 16600,
"date": "2019-05-08"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "96a44e07-2158-43e4-8baa-8f6f56922ba8",
"rate": 19600,
"date": "2019-05-07"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "96a44e07-2158-43e4-8baa-8f6f56922ba8",
"rate": 19600,
"date": "2019-05-08"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "f0a84d15-c36f-487c-9c8d-a7f907224a24",
"rate": 17600,
"date": "2019-05-07"
},
{
"stop_sell": true,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "f0a84d15-c36f-487c-9c8d-a7f907224a24",
"rate": 17600,
"date": "2019-05-08"
},
{
"stop_sell": false,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "445835fb-7956-42ac-9efc-3e6f331f0808",
"rate": 20000,
"date": "2020-09-17"
},
{
"stop_sell": false,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "5824ae4b-0cdd-441b-a01f-647177b48120",
"rate": 19000,
"date": "2020-09-17"
},
{
"stop_sell": false,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "96a44e07-2158-43e4-8baa-8f6f56922ba8",
"rate": 22000,
"date": "2020-09-17"
},
{
"stop_sell": false,
"room_type_id": "9ab6293a-a96f-4926-9f8a-06bc244aaa7a",
"rate_plan_id": "f0a84d15-c36f-487c-9c8d-a7f907224a24",
"rate": 20000,
"date": "2020-09-17"
}
]
}

Bad Request Error Response

Status Code: 400 Bad Request

{
"errors": {
"code": "bad_request",
"title": "Bad Request",
"details": [
"restrictions is required"
]
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Restriction object in the answer.

Bad Request Error Method can return a Bad Request Error result with 400 Bad Request HTTP Code if user pass wrong arguments.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.