In this part of the documentation you can learn more about the API's address resource. With this resource, it is possible to retrieve, update and delete any customer address of your shop. We will also have a look at the associated data structures.
This resource supports the following operations:
Access URL | GET | GET (List) | PUT | PUT (Batch) | POST | DELETE | DELETE (Batch) |
---|---|---|---|---|---|---|---|
/api/addresses |
If you want to access this resource, simply query the following URL:
Single address details can be retrieved via the address ID:
Model | Table |
---|---|
Shopware\Models\Customer\Address | s_user_addresses |
Field | Type | Original Object |
---|---|---|
id | integer (primary key) | |
customer | integer (primary key) | Customer |
company | string | |
department | string | |
salutation | string | |
firstname | string | |
lastname | string | |
street | string | |
zipcode | string | |
city | string | |
phone | string | |
vatId | string | |
additionalAddressLine1 | string | |
additionalAddressLine2 | string | |
country | int (foreign key) | Country |
state | int (foreign key) | |
attribute | array |
For this operation, no parameters are required. To get a list of all addresses, simply query:
Model | Table |
---|---|
Shopware\Models\Customer\Address | s_user_addresses |
This API call returns an array of elements, one for each address. Each of these elements has the same structure as a single element from above, but without the detailed customer data.
Appended to the above mentioned list, you will also find the following data:
Field | Type | Comment |
---|---|---|
total | integer | The total number of address resources |
success | boolean | Indicates if the call was successful or not. |
POST
and PUT
operations support the following data structure:
Model | Table |
---|---|
Shopware\Models\Customer\Address | s_user_addresses |
Field | Type | Comment |
---|---|---|
id | integer (primary key) | If null, a new entity will be created |
customer (required) | integer (foreign key) | |
company | string | |
department | string | |
salutation (required) | string | |
firstname (required) | string | |
lastname (required) | string | |
street (required) | string | |
zipcode (required) | string | |
city (required) | string | |
phone | string | |
vatId | string | |
additionalAddressLine1 | string | |
additionalAddressLine2 | string | |
country (required) | int (foreign key) | Country |
state | int (foreign key) | |
attribute | array |
To delete an address, simply call the specified resource with the DELETE
operation as the following example shows:
Replace the id
with the specific address id.