Retrieve an address
How to fetch a specific address via API
To fetch a single address, send a GET
request to the /api/addresses/:id
endpoint, where id
is the ID of the resource that you want to retrieve.
Request
GET https://yourdomain.commercelayer.io/api/addresses/:id
Example
The following request fetches the address identified by the id "xYZkjABcde":
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token'
On success, the API responds with a 200 OK
status code, returning a single resource object:
{
"data": {
"id": "xYZkjABcde",
"type": "addresses",
"links": {
"self": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde"
},
"attributes": {
"billing_info": "VAT ID IT02382940977",
"business": false,
"city": "New York",
"company": "The Red Brand Inc.",
"country_code": "US",
"created_at": "2018-01-01T12:00:00.000Z",
"email": "john@example.com",
"first_name": "John",
"full_address": "2883 Geraldine Lane Apt.23, 10013 New York NY (US) (212) 646-338-1228",
"full_name": "John Smith",
"is_geocoded": true,
"is_localized": true,
"last_name": "Smith",
"lat": 40.6971494,
"line_1": "2883 Geraldine Lane",
"line_2": "Apt.23",
"lng": -74.2598672,
"map_url": "https://www.google.com/maps/search/?api=1&query=40.6971494,-74.2598672",
"metadata": {
"foo": "bar"
},
"name": "John Smith, 2883 Geraldine Lane Apt.23, 10013 New York NY (US) (212) 646-338-1228",
"notes": "Please ring the bell twice",
"phone": "(212) 646-338-1228",
"provider_name": "google",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"state_code": "NY",
"static_map_url": "https://maps.googleapis.com/maps/api/staticmap?center=40.6971494,-74.2598672&size=640x320&zoom=15",
"updated_at": "2018-01-01T12:00:00.000Z",
"zip_code": "10013"
},
"relationships": {
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/events"
}
},
"geocoder": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/relationships/geocoder",
"related": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/geocoder"
}
},
"tags": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/relationships/tags",
"related": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/tags"
}
},
"versions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/relationships/versions",
"related": "https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde/versions"
}
}
},
"meta": {
"mode": "test"
}
}
}
Last updated