See the Queries page for a presentation of this resource.
Note: Les adresses liées à un client disposent aussi de mutations dédiées qui valident le client et gèrent le mode multiple : CreateCustomerAddresses , UpdateCustomerAddress et DeleteCustomerAddress .
Create an address
GraphQL
mutation CreateAddress($input: AddressInput!) {
CreateAddress(input: $input) {
id
label
country
address_1
postal_code
city
type
default
}
}
JSON
{
"input": {
"label": "Paris Office",
"country": "FR",
"address_1": "10 Rivoli Street",
"postal_code": "75001",
"city": "Paris",
"type": "billing",
"default": true,
"addressable_id": 123,
"addressable_type": "Customer"
}
}
JSON
{
"data": {
"CreateAddress": {
"id": 501,
"label": "Paris Office",
"country": "FR",
"address_1": "10 Rivoli Street",
"postal_code": "75001",
"city": "Paris",
"type": "billing",
"default": true
}
}
}
Update an address
GraphQL
mutation UpdateAddress($id: ID!, $input: AddressInput!) {
UpdateAddress(id: $id, input: $input) {
id
label
country
address_1
postal_code
city
type
default
}
}
JSON
{
"id": 501,
"input": {
"label": "Lyon Warehouse",
"address_1": "25 Foch Avenue",
"postal_code": "69006",
"city": "Lyon"
}
}
JSON
{
"data": {
"UpdateAddress": {
"id": 501,
"label": "Lyon Warehouse",
"country": "FR",
"address_1": "25 Avenue Foch",
"postal_code": "69006",
"city": "Lyon",
"type": "billing",
"default": true
}
}
}
Delete an address
GraphQL
mutation DeleteAddress($id: ID!) {
DeleteAddress(id: $id)
}
JSON
{ "data": { "DeleteAddress": true } }
id - ID Identifier (optional)
label - String Label of the address
country - String Country code (e.g. FR, US)
address_1 - String Address line 1
address_2 - String Address line 2
postal_code - String Postal code
dependent_locality - String Dependent locality
type - String Address type (e.g. billing, shipping)
default - Boolean Whether the address is default
addressable_id - ID Related entity id
addressable_type - String Related entity type (e.g. Customer)