Address
Show
Retrieve details about a particular address:
GET /api/v1/orders/1/addresses/1
Order addresses through the API will only be visible to admins and the users who own particular orders related to that addresses. If a user attempts to access an order address that does not belong to him, he will be met with an authorization error.
Users may pass in the order’s token in order to be authorized to view an order address:
GET /api/v1/orders/1/addresses/1?order_token=abcdef123456
The order_token
parameter will work for authorizing any action for an order address within Boxid API.
Response
Status:
200 OK
{"id": 1,"firstname": "Boxid","lastname": "Example","full_name": "Boxid Example","address1": "Skipholt 33","address2": "Bakhús","city": "Reykjavík","zipcode": "105","phone": "555-5555","company": null,"alternative_phone": null,"country_id": 1,"state_id": 1,"state_name": null,"state_text": "NY","country": {"id": 1,"iso_name": "UNITED STATES","iso": "US","iso3": "USA","name": "United States","numcode": 1},"state": {"id": 1,"name": "New York","abbr": "NY","country_id": 1}}
Update
To update an address, make a request like this:
PUT /api/v1/orders/1/addresses/1?address[firstname]=Ryan
This request will update the firstname
field for an address to the value of ”Ryan”
Response
Status:
200 OK
{"id": 1,"firstname": "Ryan","lastname": "Example","full_name": "Boxid Example","address1": "Skipholt 33","address2": "Bakhús","city": "Reykjavík","zipcode": "105","phone": "555-5555","company": null,"alternative_phone": null,"country_id": 1,"state_id": 1,"state_name": null,"state_text": "NY","country": {"id": 1,"iso_name": "UNITED STATES","iso": "US","iso3": "USA","name": "United States","numcode": 1},"state": {"id": 1,"name": "New York","abbr": "NY","country_id": 1}}
Valid address fields are:
- firstname
- lastname
- company
- address1
- address2
- city
- zipcode
- phone
- alternative_phone
- country_id
- state_id
- state_name