Photo Tags Modification

This endpoint is used to update tags associated with a photo of a given room. Note that the old tags will be completely replaced by the new ones. For example, if your photo is currently associated with tags with ID of 1, 2, and 3, you make this request with in array of IDs such as [4, 5, 6]. Your photo now should contain only tags with ID of 4, 5, and 6.

If you pass and empty array of tags via tags parameter or omit this parameter completely. Those actions is equivalent to deleting all of current tags of the photo.

Endpoint

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

Data Params

Param Description Type Required
tags An array of tag IDs to attach to a photo Array No

Route Params

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

Request & Response Examples

Successful Response

200

Example request

curl \
  --request POST \
  --url https://api.luxstay.com/api/rooms/10000/photos/4400/tags \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <token>' \
  --form 'tags[0]=4' \
  --form 'tags[1]=5' \
  --form 'tags[2]=6'
1
2
3
4
5
6
7
8

Example response

{
    "data": [
        {
            "id": 4,
            "name": "Garden",
            "normalized": "garden"
        },
        {
            "id": 5,
            "name": "Bathroom",
            "normalized": "bathroom"
        },
        {
            "id": 6,
            "name": "Kitchen",
            "normalized": "kitchen"
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Error Response

401

Reason invalid access token

Example response

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

403

Reason unauthorized to update information 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

  • Reason cannot find the given photo

Example response

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

500

Reason unable to update tags for a given photo

Example response

{
    "message": "Unable to update tags for the given photo."
}
1
2
3
Last Updated: 11/18/2018, 9:11:26 AM