Glue API: Manage customer addresses
Edit on GitHubThis endpoints allows retrieving and edit customer addresses.
Installation
For details on the modules that provide the API functionality and how to install them, see Glue API: Customer Access Feature Integration.
Add an address
To add an address to a customer, send the request:
POST
/customers/{{customer_id}}/addresses
PATH PARAMETER | DESCRIPTION |
---|---|
{{customer_id}} | Unique identifier of the customer to add the address to. To get it, Retrieve customers or Create a customer. |
Request
Request sample: add an address
POST http://glue.mysprykershop.com/customers/DE--1/addresses
{
"data" : {
"type": "addresses",
"attributes": {
"customer_reference": "DE--1",
"salutation": "Mr",
"firstName": "Spencor",
"lastName": "Hopkin",
"address1": "Third, 33, 11",
"address2": "b",
"address3": "aaa",
"zipCode": "12312",
"city": "Berlin",
"country": "Germany",
"iso2Code" : "DE",
"phone": "22111-3-4-5",
"isDefaultShipping": false,
"isDefaultBilling": false
}
}
}
ATTRIBUTE | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
customer_reference | String | ✓ | Unique identifier of the customer to add the address to. To get it, Retrieve customers or Create a customer |
salutation | String | ✓ | Salutation to use when addressing the customer. |
firstName | String | ✓ | Customer’s first name. |
lastName | String | ✓ | Customer’s last name. |
address1 | String | ✓ | The 1st line of the customer’s address. |
address2 | String | ✓ | The 2nd line of the customer’s address. |
address3 | String | ✓ | The 3rd line of the customer’s address. |
zipCode | String | ✓ | ZIP code. |
city | String | ✓ | Specifies the city. |
country | String | ✓ | Specifies the country. |
iso2Code | String | ✓ | Specifies an ISO 2 Country Code to use. |
company | String | ✓ | Customer’s company. |
phone | String | ✓ | Customer’s phone number. |
isDefaultShipping | Boolean | ✓ | Specifies whether the address should be used as the default shipping address of the customer. If the parameter is not set, the default value is true. |
isDefaultBilling | Boolean | ✓ | Specifies whether the address should be used as the default billing address of the customer. If the parameter is not set, the default value is true. |
Response
Response sample: add an address
{
"data": {
"type": "addresses",
"id": "5caa05f5-41f5-5e6c-a254-07d7887fb4e9",
"attributes": {
"salutation": "Mr",
"firstName": "Spencor",
"lastName": "Hopkin",
"address1": "Third, 33, 11",
"address2": "b",
"address3": "aaa",
"zipCode": "12312",
"city": "Berlin",
"country": "Germany",
"iso2Code": "DE",
"company": null,
"phone": "22111-3-4-5",
"isDefaultShipping": false,
"isDefaultBilling": false
},
"links": {
"self": "https://glue.mysprykershop.com/customers/DE--1/addresses/5caa05f5-41f5-5e6c-a254-07d7887fb4e9"
}
}
}
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
salutation | String | Salutation to use when addressing to the customer. |
firstName | String | Customer’s first name. |
lastName | String | Customer’s last name. |
address1 | String | The 1st line of the customer’s address. |
address2 | String | The 2nd line of the customer’s address. |
address3 | String | The 3rd line of the customer’s address. |
zipCode | String | ZIP code. |
city | String | Specifies the city. |
country | String | Specifies the country. |
iso2Code | Specifies an ISO 2 Country Code to use. | |
company | String | Specifies the customer’s company. |
phone | String | Specifies the customer’s phone number. |
isDefaultShipping | Boolean | Specifies whether the address should be used as the default shipping address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
isDefaultBilling | Boolean | Specifies whether the address should be used as the default billing address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
Edit an address
To edit an address, send the request:
PATCH
/customers/{{customer_id}}/addresses/{{address_id}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{customer_id}} | Unique identifier of the customer to edit the address of. Create a customer to get it. |
{{address_id}} | Unique identifier of the address to edit. Add an address to get it. |
Request
Request sample: edit an address
PATCH
http://glue.mysprykershop.com/customers/DE-25/addresses/3a6ee102-007f-5245-aaec-af5b6e05685b
Request sample body
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
salutation | String | Salutation to use when addressing the customer. |
firstName | String | Customer’s first name. |
lastName | String | Customer’s last name. |
address1 | String | The 1st line of the customer’s address. |
address2 | String | The 2nd line of the customer’s address. |
address3 | String | The 3rd line of the customer’s address. |
zipCode | String | ZIP code. |
city | String | Specifies the city. |
country | String | Specifies the country. |
iso2Code | String | Specifies an ISO 2 Country Code to use. |
company | String | Specifies the customer’s company. |
phone | String | Specifies the customer’s phone number. |
isDefaultShipping | Boolean | Specifies whether the address should be used as the default shipping address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
isDefaultBilling | Boolean | Specifies whether the address should be used as the default billing address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
Response
Response sample: edit an address
{
"data": {
"type": "addresses",
"id": 3a6ee102-007f-5245-aaec-af5b6e05685b,
"attributes": {
"salutation": "Mr",
"firstName": "John",
"lastName": "Doe",
"address1": "11 Second Street",
"address2": "4th Floor",
"address3": "Suite 555",
"zipCode": "12312",
"city": "Berlin",
"country": "United States",
"iso2Code": "US",
"company": null,
"phone": "22111-3-4-5",
"isDefaultShipping": false,
"isDefaultBilling": false
},
"links": {
"self": "http://glue.mysprykershop.com.com/customers/DE--25/addresses/"
}
}
}
For response attributes, see Add an address.
Retrieve customer’s addresses
To retrieve a list of customer’s addresses, send the request:
GET
/customers/{{customer_id}}/addresses
PATH PARAMETER | DESCRIPTION |
---|---|
{{customer_id}} | Unique identifier of the customer to retrieve the list of. Create a customer to get this id. |
Request
Request sample: retrieve customer’s addresses
GET http://glue.mysprykershop.com/customers/DE-25/addresses
Response
Response sample: retrieve customer's addresses
{
"data": [
{
"type": "addresses",
"id": "3a6ee102-007f-5245-aaec-af5b6e05685b",
"attributes": {
"salutation": "Mr",
"firstName": "Jason",
"lastName": "Voorhees",
"address1": "123 Sleep Street",
"address2": "123",
"address3": null,
"zipCode": "12345",
"city": "Dresden",
"country": "Germany",
"iso2Code": "DE",
"company": null,
"phone": null,
"isDefaultShipping": true,
"isDefaultBilling": true
},
"links": {
"self": "http://glue.mysprykershop.com/customers/DE--25/addresses/3a6ee102-007f-5245-aaec-af5b6e05685b"
}
},
{
"type": "addresses",
"id": "5f00ce65-dd64-5b49-ad3c-f5fae475e7e6",
"attributes": {
"salutation": "Mr",
"firstName": "John",
"lastName": "Doe",
"address1": "11 Second Street",
"address2": "4th Floor",
"address3": "Suite 555",
"zipCode": "12312",
"city": "Berlin",
"country": "United States",
"iso2Code": "US",
"company": null,
"phone": "22111-3-4-5",
"isDefaultShipping": false,
"isDefaultBilling": false
},
"links": {
"self": "http://glue.mysprykershop.com/customers/DE--25/addresses/5f00ce65-dd64-5b49-ad3c-f5fae475e7e6"
}
}
],
"links": {
"self": "http://glue.mysprykershop.com/customers/DE--25/addresses"
}
}
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
salutation | String | Salutation to use when addressing the customer. |
firstName | String | Customer’s first name. |
lastName | String | Customer’s last name. |
address1 | String | The 1st line of the customer’s address. |
address2 | String | The 2nd line of the customer’s address. |
address3 | String | The 3rd line of the customer’s address. |
zipCode | String | ZIP code. |
city | String | Specifies the city. |
country | String | Specifies the country. |
iso2Code | String | Specifies an ISO 2 Country Code to use. |
company | String | Specifies customer’s company. |
phone | String | Specifies customer’s phone number. |
isDefaultShipping | Boolean | Specifies whether the address should be used as the default shipping address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
isDefaultBilling | Boolean | Specifies whether the address should be used as the default billing address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
Retrieve an address
To retrieve an address, send the request:
GET
/customers/{{customer_id}}/addresses/{{address_id}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{customer_id}} | Unique identifier of the customer to retrieve the address of. Create a customer to get it. |
{{address_id}} | Unique identifier of the address to retrieve. Add an address to get it. |
Request
Request sample: retrieve an address
GET http://glue.mysprykershop.com/customers/DE-25/addresses/3a6ee102-007f-5245-aaec-af5b6e05685b
Response
Response sample: retrieve an address
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
salutation | String | Salutation to use when addressing the customer |
firstName | String | Customer’s first name |
lastName | String | Customer’s last name |
address1 | String | The 1st line of the customer’s address |
address2 | String | The 2nd line of the customer’s address |
address3 | String | The 3rd line of the customer’s address |
zipCode | String | ZIP code |
city | String | Specifies the city |
country | String | Specifies the country |
iso2Code | String | Specifies an ISO 2 Country Code to use |
company | String | Specifies the customer’s company |
phone | String | Specifies the customer’s phone number |
isDefaultShipping | Boolean | Specifies whether the address should be used as the default shipping address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
isDefaultBilling | Boolean | Specifies whether the address should be used as the default billing address of the customer. If the parameter is not set, the default value is true. This is also the case for the first address to be saved. |
If the request is successful, the endpoint returns RestAddressesResponse with the requested address.
Delete an address
To delete an address, send the request:
DELETE
/customers/{{customer_id}}/addresses/{{address_id}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{customer_id}} | Unique identifier of the customer to delete the address of. Create a customer to get it. |
{{address_id}} | Unique identifier of the address to delete. Add an address to get it. |
Request
Request sample: delete an address
DELETE http://glue.mysprykershop.com/customers/DE-25/addresses/3a6ee102-007f-5245-aaec-af5b6e05685b
Response
If the address is deleted successfully, the endpoint returns the 204 No Content
status code.
Possible errors
CODE | REASON |
---|---|
001 | Access token is invalid. |
002 | Access token is missing. |
402 | Customer with the specified ID is not found. |
404 | Specified address cannot be found. |
405 | Customer reference is missing. |
409 | Failed to update an address. |
411 | Unauthorized request. |
412 | No address ID provided. |
901 | One of the following fields is not specified: salutaion , firstName , lastName , city , address1 , address2 , zipCode , country , iso2Code , isDefaultShipping , isDefaultBilling |
To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.
Next steps
Thank you!
For submitting the form