Room Types Collection

API methods to work with Room Types

Room Type is entity to represent accommodation inventory at your properties. Your villa, room or bed at dormitory can be represented as Room Type.

Room Types List

Retrieve list of Room Types associated with user Properties.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/room_types

Success Response Example

Status Code: 200 OK

{
"data": [
{
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"attributes": {
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"title": "Standard Room",
"occ_adults": 3,
"occ_children": 0,
"occ_infants": 0,
"default_occupancy": 2,
"count_of_rooms": 20,
"content": {
"description": "Some Room Type Description Text",
"photos": [
{
"author": "Author Name",
"description": "Room View",
"id": "198a19d4-42c0-48d8-a55c-c7836b2c1f7e",
"kind": "photo",
"position": 0,
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
}
]
}
},
"relationships": {
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
]
}

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 list of Room Type objects in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Get Room Type by ID

Retrieve specific Room Type by ID.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/room_types/:id

Success Response Example

Status Code: 200 OK

{
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"attributes": {
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"title": "Standard Room",
"occ_adults": 3,
"occ_children": 0,
"occ_infants": 0,
"default_occupancy": 2,
"count_of_rooms": 20,
"content": {
"description": "Some Room Type Description Text",
"photos": [
{
"author": "Author Name",
"description": "Room View",
"id": "198a19d4-42c0-48d8-a55c-c7836b2c1f7e",
"kind": "photo",
"position": 0,
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
}
]
}
},
"relationships": {
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

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

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "not_found",
"title": "Resouce Not Found"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Room Type object in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided or User not have access to requested Room Type.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Room Type with provided ID is not present at system.

Create Room Type

Create new Room Type.

Request
Success Response
Error Response

Request:

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

Query body (JSON):

{
"room_type": {
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"title": "Standard Room",
"count_of_rooms": 20,
"occ_adults": 3,
"occ_children": 0,
"occ_infants": 0,
"default_occupancy": 2,
"content": {
"description": "Some Room Type Description Text",
"photos": [
{
"author": "Author Name",
"description": "Room View",
"kind": "photo",
"position": 0,
"url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
}
]
}
}
}

Success Response Example

Status Code: 201 Created

{
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"attributes": {
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"title": "Standard Room",
"occ_adults": 3,
"occ_children": 0,
"occ_infants": 0,
"default_occupancy": 2,
"count_of_rooms": 20,
"content": {
"description": "Some Room Type Description Text",
"photos": [
{
"author": "Author Name",
"description": "Room View",
"id": "198a19d4-42c0-48d8-a55c-c7836b2c1f7e",
"kind": "photo",
"position": 0,
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
}
]
}
},
"relationships": {
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

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

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"title": [
"can't be blank"
]
}
}
}

Fields

property_id [required]

String with valid UUID of Property object what you would like to associate with created Room Type.

title [required]

Any non-empty string with maximum length of 255 symbols. Note: The Room Type will be represented in the system under that title.

count_of_rooms [required]

Any positive integer number. Note: This field represent how many items of created Room Type you have at Property.

occ_adults [required]

Any positive integer number. Note: This field represent how many places to sleep Adult person you have at one item of Room Type.

occ_children [required]

Any positive integer number. Note: This field represent how many places where only Children or Infants can sleep at one item of Room Type.

occ_infants [required]

Any positive integer number. Note: This field represent how many places where only Infants can sleep you have at one item of Room Type. Example: count of baby cots.

default_occupancy [required]

Any positive integer number lower or equal to occ_adults. Note: This field represent how many guests can stay at room by default (without extra spaces). Keep in mind, this field can not be greater then occ_adults value. Field is optional, by default equal to occ_adults.

content [optional]

Object with content information for property. Content object can contain: description - optional text field with Property description. By default Description will be equal to null. photos - optional list of photos associated with Property. Each photo is object with next fields: url - photo URL position - integer value to represent photo position at list, Photo with position equal to 0 is used as Cover Photo for Room Type description - Photo text description author - Name of photo Author kind - one of three possible values: photo, ad (advertising), menu (restaurant menu photo). More information about Photo API is here.

Returns

Success Method can return a Success result with 201 Created HTTP Code if operation is successful. Will contain a Room Type object in the answer.

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

Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Update Room Type

Update Room Type.

Request
Success Response
Error Response

Request:

PUT https://staging.channex.io/api/v1/room_types/:id

Query body (JSON):

{
"room_type": {
"title": "Standard Room",
"count_of_rooms": 20,
"occ_adults": 3,
"occ_children": 0,
"occ_infants": 0,
"default_occupancy": 2,
"content": {
"description": "Some Room Type Description Text",
"photos": [
{
"author": "Author Name",
"description": "Room View",
"kind": "photo",
"position": 0,
"url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
}
]
}
}
}

Success Response Example

Status Code: 200 OK

{
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"attributes": {
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"title": "Standard Room",
"occ_adults": 3,
"occ_children": 0,
"occ_infants": 0,
"default_occupancy": 2,
"count_of_rooms": 20,
"content": {
"description": "Some Room Type Description Text",
"photos": [
{
"author": "Author Name",
"description": "Room View",
"id": "198a19d4-42c0-48d8-a55c-c7836b2c1f7e",
"kind": "photo",
"position": 0,
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
}
]
}
},
"relationships": {
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

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

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found"
"title": "Resource Not Found"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"title": [
"can't be blank"
]
}
}
}

Fields

This method use same fields as Create Room Type method.

Returns

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

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Room Type with provided ID is not present at system.

Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Remove Room Type

Remove Room Type.

Request
Success Response
Error Response

Request:

DELETE https://staging.channex.io/api/v1/room_types/:id

Success Response Example

Status Code: 200 OK

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

Unauthorised Error Response

Status Code: 401 Unauthorized

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

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found"
"title": "Resource Not Found"
}
}

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.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Room Type with provided ID is not present at system.