/customers/id
Update a single address of an existing customer.
Addresses can be managed manually from the customer profile or flow from orders. Changing an address in a customer profile does not affect orders, but changing the address in an order may affect it in the customer profile.
URL parameters
Parameters that you can append to the URL, for example: ?parameter=value
Title | Type | Description | Required? |
---|---|---|---|
id | int | ID of a single customer to update. Can be used after the slash. Example: customers/27 update customer with ID 27 | Yes |
Request body parameters
Parameters that you can send in the request body in JSON format, for example:
{"email": "[email protected]","first_name": "James"}
Title | Type | Description | Required? |
---|---|---|---|
address | array | Array containing the details of the address that should be updated | Yes |
address.id | int | ID of the address to update | Yes |
address.shipping.first_name | string | First name for shipping | No |
address.shipping.last_name | string | Last name for shipping | No |
address.shipping.company | string | Company for shipping | No |
address.shipping.street | string | Street name for shipping | No |
address.shipping.suite | string | Suite for shipping | No |
address.shipping.city | string | City for shipping | No |
address.shipping.country | string | Country for shipping, 2-letter code as per ISO 3166-1 | No |
address.shipping.state | string | State/province/region for shipping, 2-letter code as per ISO 3166-2 | No |
address.shipping.zip | string | Zip/postal code for shipping | No |
address.billing.first_name | string | First name for billing | No |
address.billing.last_name | string | Last name for billing | No |
address.billing.street | string | Street name for billing | No |
address.billing.suite | string | Suite for billing | No |
address.billing.city | string | City for billing | No |
address.billing.country | string | Country for billing, 2-letter code as per ISO 3166-1 | No |
address.billing.state | string | State/province/region for billing, 2-letter code as per ISO 3166-2 | No |
address.billing.zip | string | Zip/postal code for billing | No |
address.phone | string | Phone for the address | No |
Response attributes
Attributes that you will receive in response from the endpoint in JSON format, for example:
{"email": "[email protected]","first_name": "James"}
Title | Type | Description |
---|---|---|
id | int | ID of the customer |
string | Email of the customer | |
first_name | string | First name of the customer |
last_name | string | Last name of the customer |
address | object containing arrays | One or multiple addresses assigned to the customer |
address.id | id | ID of the address |
address.shipping.first_name | string | First name for shipping |
address.shipping.last_name | string | Last name for shipping |
address.shipping.company | string | Company for shipping |
address.shipping.street | string | Street name for shipping |
address.shipping.suite | string | Suite for shipping |
address.shipping.city | string | City for shipping |
address.shipping.country | string | Country for shipping, 2-letter code as per ISO 3166-1 |
address.shipping.state | string | State/province/region for shipping, 2-letter code as per ISO 3166-2 |
address.shipping.zip | string | Zip/postal code for shipping |
address.billing.first_name | string | First name for billing |
address.billing.last_name | string | Last name for billing |
address.billing.street | string | Street name for billing |
address.billing.suite | string | Suite for billing |
address.billing.city | string | City for billing |
address.billing.country | string | Country for billing, 2-letter code as per ISO 3166-1 |
address.billing.state | string | State/province/region for billing, 2-letter code as per ISO 3166-2 |
address.billing.zip | string | Zip/postal code for billing |
address.phone | string | Phone for the address |
payment.type | string | Type of payment method. Can be: Visa, American Express, MasterCard, Discover, JCB, Diners Club, PayPal |
payment.last4 | string | Last 4 digits of the card number, if paid by card |
notes | string | Notes about the customer, optionally set by the store owner |
statistics.last_purchase | int | Timestamp of last purchase by the customer |
statistics.order_count | int | Number of orders the customer has placed |
statistics.lifetime_spent | int | Amount of money spent by customer on this store |
orders | array of ints | Array of the customer's order IDs |
tags | array of strings | Array containing the tags of all the products that the customer bought |
created_at | int | Timestamp of the customer creation time |
updated_at | int | Timestamp of the customer last update time |
PATCH https://mystore.commercehq.com/api/v1/customers/30
{
"address": {
"id": 77,
"shipping": {
"first_name": "jamie"
},
"phone": "123"
}
}
{
"id": 6,
"email": "[email protected]",
"first_name": "James",
"last_name": "C Smith",
"address": [
{
"id": 7,
"shipping": {
"first_name": "James",
"last_name": "C Smith",
"company": null,
"street": "46 Leatherwood St.",
"suite": "1432",
"city": "North Hollywood",
"country": "US",
"state": "CA",
"zip": "91605"
},
"billing": {
"first_name": "James",
"last_name": "C Smith",
"street": "46 Leatherwood St.",
"suite": "1432",
"city": "North Hollywood",
"country": "US",
"state": "CA",
"zip": "91605"
},
"phone": "any string here"
}
],
"payment": [],
"notes": "Some Notes about customer",
"statistics": {
"last_purchase": null,
"order_count": null,
"lifetime_spent": 0
},
"orders": [],
"tags": [],
"created_at": 1485004452,
"updated_at": 1485004452
}