This endpoint is used to update the current collection of amenities associated with a given room. This is done by performing a hard replacement of new
amenities to the old ones. For example, if your room is currently associated with amenities with ID of 1, 2, and 3, you make this request with in array
of IDs such as [4, 5, 6]. Your room now should contain only amenities with ID of 4, 5, and 6.
| Method | URI | Headers |
|---|---|---|
| POST | /api/rooms/{room}/amenities | Authorization: Bearer <token> Accept: application/json |
| Param | Description | Type | Required |
|---|---|---|---|
| amenities | An array of amenity IDs associated with the room. | Array | Yes |
| Param | Description | Type | Required |
|---|---|---|---|
| {room} | The ID of a given room. | Integer | Yes |
Example request
curl \
--request POST \
--url https://api.luxstay.com/api/rooms/10000/amenities \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--form 'amenities[0]=159' \
--form 'amenities[1]=160'
Example response
{
"data": [
{
"id": 159,
"name": "Luggage dropoff allowed",
"description": "",
"type": {
"data": {
"id": 11,
"name": "Other",
"description": ""
}
}
},
{
"id": 160,
"name": "Long term stays allowed",
"description": "",
"type": {
"data": {
"id": 11,
"name": "Other",
"description": ""
}
}
}
]
}
Reason invalid access token
Example response
{
"message": "Unauthenticated."
}
Reason unauthorized to update amenities of the room
Example response
{
"message": "You are not allowed to access or change information associated with this room."
}
Reason cannot find the given room
Example response
{
"message": "Cannot find the given room"
}
Reason unable to update amenities of the room
Example response
{
"message": "Cannot update the amenities of the given room."
}