This endpoint is used to update (or upload) photos for a given room. Multiple files can be uploaded in a single request.
Method | URI | Headers |
---|---|---|
POST | /api/rooms/{room}/photos | Authorization: Bearer <token> Accept: application/json |
Param | Description | Type | Required |
---|---|---|---|
file | An array of image files used for uploading process. Supported mime types are JPG, PNG, and GIF. Maximum size is 8MB. | 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/photos \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'photo[0]=/path/to/image/living-room.jpg' \
--form 'photo[1]=/path/to/image/bathroom.jpg'
Example response
{
"data": [
{
"id": 4400,
"name": "living-room.jpg",
"highlights": "",
"featured": true,
"slide": true,
"order": 0,
"caption": "<content>",
"photo_url": "https://image.luxstay.com/rooms/10000/large/living-room.jpg?w=1200&fit=crop&v=RGb88hdhC0QcgspvCupZ0CQsq",
"thumbnail": "https://image.luxstay.com/rooms/10000/thumbnail/living-room.jpg?w=250&fit=crop&v=RGb88hdhC0QcgspvCupZ0CQsq"
},
{
"id": 4401,
"name": "bathroom.jpg",
"highlights": "",
"featured": false,
"slide": true,
"order": 0,
"caption": "<content>",
"photo_url": "https://image.luxstay.com/rooms/10000/large/bathroom.jpg?w=1200&fit=crop&v=RGb88hdhC0QcgspvCupZ0CQsq",
"thumbnail": "https://image.luxstay.com/rooms/10000/thumbnail/bathroom.jpg?w=250&fit=crop&v=RGb88hdhC0QcgspvCupZ0CQsq"
}
]
}
Reason invalid uploaded files
Example response
{
"message": "Cannot processing the uploaded files."
}
Reason invalid access token
Example response
{
"message": "Unauthenticated."
}
Reason unauthorized to update photos of a given 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"
}