This endpoint is used to create new room for a given host. When creating new room, we just need to provide basic information of the room such as
name, property type, room type, standard number of guests and maximum number of guests. Your can also specify the the locale of the room by using
Accept-Language header, refer to this section of the documentation for more information.
| Method | URI | Headers |
|---|---|---|
| POST | /api/rooms | Authorization: Bearer <token> Accept: application/json Accept-Language: <language> |
| Param | Description | Type | Required |
|---|---|---|---|
| name | The name of the room. | String | Yes |
| room_type | The type of the room. | Integer | Yes |
| property | The property type associated with the room. | Integer | Yes |
| accommodates | The maximum number of guests. | Integer | Yes |
| standard_guests | The number of standard guests. | Integer | Yes |
Example request
curl \
--request POST \
--url https://api.luxstay.com/api/rooms \
--header 'Accept: application/json' \
--header 'Accept-Language: vi' \
--header 'Authorization: Bearer <token>' \
--form 'name=Test Apartment' \
--form room_type=1 \
--form property_type=1 \
--form accommodates=5 \
--form standard_guests=4
Example response
{
"data": {
"id": 10775,
"host": 10130,
"name": "Test Apartment",
"num_bedrooms": null,
"num_bathrooms": null,
"num_beds": null,
"standard_guests": 4,
"maximum_guests": 5,
"booking_type": null,
"status": null,
"submit_status": null,
"cancellation_policy": "Flexible",
"roomType": {
"data": {
"id": 1,
"name": "Entire home/apt",
"description": "Entire home/apt"
}
},
"propertyType": {
"data": {
"id": 1,
"name": "Apartment",
"description": "Apartment"
}
}
}
}
Reason invalid access token
Example response
{
"message": "Unauthenticated."
}
Reason validation errors
Example response
{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"room_type": [
"The room type must be an integer."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"room_type": [
"The selected room type is invalid."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"standard_guests": [
"The standard guests must be less than or equal 5."
]
}
}