Get Customer Addresses
GET
Get all of a customers addresses
https://api.moltin.com/v2/customers/:customerId/addresses
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
customerId | Required | string | A customer ID that has addresses. |
Headers:
Name | Required | Type | Description |
---|---|---|---|
X-Moltin-Customer-Token | Optional | string | A customer token used to access customer addresses implicitly. |
Authorization | Required | string | The Bearer token to grant access to the API. |
200 OK
{
"data": [
{
"id": "5f8da740-6680-463e-b31c-190b2db4bf9d",
"type": "address",
"name": "Home",
"first_name": "Ron",
"last_name": "Swanson",
"company_name": "",
"phone_number": "(555) 555-1234",
"line_1": "1 Sunny Street",
"line_2": "Sunny Place",
"city": "Sunny Town",
"postcode": "SU33 1YY",
"county": "Sunnyville",
"country": "GB",
"instructions": "Leave in the shed",
"links": {
"self":
"https://api.moltin.com/v2/addresses/5f8da740-6680-463e-b31c-190b2db4bf9d"
},
"meta": {
"timestamps": {
"created_at": "2018-05-04T15:20:09.734Z",
"updated_at": "2018-05-04T15:20:09.734Z"
}
}
}
]
}
With customer token
curl -X GET https://api.moltin.com/v2/customers/:customer_id/addresses \
-H "X-Moltin-Customer-Token: XXXX"
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const customerId = 'XXXX'
const addressId = 'XXXX'
const customerToken = 'XXXX'
Moltin.Addresses.All({
customer: customerId,
token: customerToken
}).then(addresses => {
// Do something
})
Without customer token
curl -X GET https://api.moltin.com/v2/customers/:customer_id/addresses \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const customerId = 'XXXX'
const addressId = 'XXXX'
Moltin.Addresses.All({
customer: customerId
}).then(addresses => {
// Do something
})