Update an Address
Updates the specified address for the current user.
PATCH
/
api
/
v2
/
storefront
/
account
/
addresses
/
{id}
Update an Address
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
address: {
firstname: 'Stephen',
lastname: 'Smith',
company: 'Woodbank School',
address1: '234 Old Georgetown Road',
address2: '1st Floor',
city: 'Aethesda',
phone: '34885493845002',
zipcode: '90211',
state_name: 'CA',
country_iso: 'US',
label: 'Office'
}
})
};
fetch('https://demo.spreecommerce.org/api/v2/storefront/account/addresses/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://demo.spreecommerce.org/api/v2/storefront/account/addresses/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"address": {
"firstname": "Stephen",
"lastname": "Smith",
"company": "Woodbank School",
"address1": "234 Old Georgetown Road",
"address2": "1st Floor",
"city": "Aethesda",
"phone": "34885493845002",
"zipcode": "90211",
"state_name": "CA",
"country_iso": "US",
"label": "Office"
}
}
'{
"data": {
"id": "29",
"type": "address",
"attributes": {
"firstname": "Mark",
"lastname": "Winterburn",
"address1": "775645 Old Georgetown Road",
"address2": "3rd Floor",
"city": "Qethesda",
"zipcode": "90210",
"phone": "3488545445002",
"state_name": "California",
"company": "Paper Street Soap Co.",
"country_name": "United States",
"country_iso3": "USA",
"country_iso": "US",
"label": "Work",
"state_code": "CA"
}
}
}{
"error": "You are not authorized to access this page."
}Authorizations
User token to authorize Cart and Checkout requests.
It is required to associate Cart with the User.
Path Parameters
The ID of the specified address.
Example:
"1"
Query Parameters
Specify the fields you would like returned in the response body. More information.
Body
application/vnd.api+json
Show child attributes
Show child attributes
Example:
{
"firstname": "John",
"lastname": "Snow",
"address1": "7735 Old Georgetown Road",
"address2": "2nd Floor",
"city": "Bethesda",
"phone": "3014445002",
"zipcode": "20814",
"state_name": "MD",
"country_iso": "US"
}
Response
200 Success - Returns the address object.
The Address model holds the customer details, such as name, address, and phone number.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Update an Address
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
address: {
firstname: 'Stephen',
lastname: 'Smith',
company: 'Woodbank School',
address1: '234 Old Georgetown Road',
address2: '1st Floor',
city: 'Aethesda',
phone: '34885493845002',
zipcode: '90211',
state_name: 'CA',
country_iso: 'US',
label: 'Office'
}
})
};
fetch('https://demo.spreecommerce.org/api/v2/storefront/account/addresses/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://demo.spreecommerce.org/api/v2/storefront/account/addresses/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"address": {
"firstname": "Stephen",
"lastname": "Smith",
"company": "Woodbank School",
"address1": "234 Old Georgetown Road",
"address2": "1st Floor",
"city": "Aethesda",
"phone": "34885493845002",
"zipcode": "90211",
"state_name": "CA",
"country_iso": "US",
"label": "Office"
}
}
'{
"data": {
"id": "29",
"type": "address",
"attributes": {
"firstname": "Mark",
"lastname": "Winterburn",
"address1": "775645 Old Georgetown Road",
"address2": "3rd Floor",
"city": "Qethesda",
"zipcode": "90210",
"phone": "3488545445002",
"state_name": "California",
"company": "Paper Street Soap Co.",
"country_name": "United States",
"country_iso3": "USA",
"country_iso": "US",
"label": "Work",
"state_code": "CA"
}
}
}{
"error": "You are not authorized to access this page."
}
