Address Modification

This endpoint is used to update the current address of a given room.

Endpoint

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

Data Params

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

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/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
1
2
3
4
5
6
7
8
9
10
11
12

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."
            }
        }
    }
}
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 address of a given 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

422

Reason validation errors

Example response

{
    "message": "The given data was invalid.",
    "errors": {
        "address_line_1": [
            "The address line 1 field is required."
        ]
    }
}
1
2
3
4
5
6
7
8
{
    "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."
        ]
    }
}
1
2
3
4
5
6
7
8
9
10
11
{
    "message": "The given data was invalid.",
    "errors": {
        "country": [
            "The country may not be greater than 50 characters."
        ]
    }
}
1
2
3
4
5
6
7
8
Last Updated: 11/18/2018, 9:11:26 AM