Amenities Modification

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.

Endpoint

Method URI Headers
POST /api/rooms/{room}/amenities Authorization: Bearer <token>
Accept: application/json

Data Params

Param Description Type Required
amenities An array of amenity IDs associated with the room. Array Yes

Route Params

Param Description Type Required
{room} The ID of a given room. Integer Yes

Request & Response Examples

Successful Response

200

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'
1
2
3
4
5
6
7

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": ""
                }
            }
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

Error Response

401

Reason invalid access token

Example response

{
    "message": "Unauthenticated."
}
1
2
3

403

Reason unauthorized to update amenities of the room

Example response

{
    "message": "You are not allowed to access or change information associated with this room."
}
1
2
3

404

Reason cannot find the given room

Example response

{
    "message": "Cannot find the given room"
}
1
2
3

500

Reason unable to update amenities of the room

Example response

{
    "message": "Cannot update the amenities of the given room."
}
1
2
3
Last Updated: 11/18/2018, 9:11:26 AM