This endpoint is used to update the current address of a given room.
Method | URI | Headers |
---|---|---|
POST | /api/rooms/{room}/address | Authorization: Bearer <token> Accept: application/json |
Param | Description | Type | Required |
---|---|---|---|
address_line_1 | The first address line of the room. Minimum length: 5 Maximum length: MAX_STRING_LENGTH | String | Yes |
address_line_2 | The second address line of the room. Minimum length: 5 Maximum length: MAX_STRING_LENGTH | String | No |
latitude | The latitude of the room location. Maximum length: 50 | String | Yes |
longitude | The longitude of the room location. Maximum length: 50 | String | Yes |
city | The city where the room located. Maximum length: 100 | String | No |
state | The state where the room located. Maximum length: 100 | String | No |
country | The country where the room located. Maximum length: 50 | String | No |
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/address \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--form 'address_line_1=445 Mount Eden Road, Mount Eden, Auckland.' \
--form 'address_line_2=21 Greens Road RD 2 Ruawai 0592.' \
--form latitude=44.968046 \
--form longitude=-94.420307 \
--form city=Hanoi \
--form state=Hanoi \
--form country=Vietnam
Example response
{
"data": {
"id": 10000,
"host": 10130,
"name": "Apartment 1",
"num_bedrooms": 5,
"num_bathrooms": 4,
"num_beds": 8,
"standard_guests": 5,
"maximum_guests": 15,
"booking_type": "instant_book",
"status": "Listed",
"submit_status": "Accept",
"cancellation_policy": "Flexible",
"address": {
"data": {
"address_line_1": "445 Mount Eden Road, Mount Eden, Auckland.",
"address_line_2": "21 Greens Road RD 2 Ruawai 0592.",
"city": "Đống Đa",
"state": "Hà Nội",
"country": "Vietnam",
"latitude": "44.968046",
"longitude": "-94.420307",
"full_address": "21 Greens Road RD 2 Ruawai 0592., 445 Mount Eden Road, Mount Eden, Auckland."
}
}
}
}
Reason invalid access token
Example response
{
"message": "Unauthenticated."
}
Reason unauthorized to update address 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"
}
Reason validation errors
Example response
{
"message": "The given data was invalid.",
"errors": {
"address_line_1": [
"The address line 1 field is required."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"latitude": [
"The latitude field is an invalid latitude value."
],
"longitude": [
"The longitude field is an invalid longitude value."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"country": [
"The country may not be greater than 50 characters."
]
}
}