In this part of the documentation you can learn more about the API's customer resource. With this resource, it is possible to retrieve, update and delete any customer 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/customers |
If you want to access this resource, simply append your shop URL with
It is required to parametrize this API call. The following parameters are available:
Identifier | Parameter | DB column | Example call |
---|---|---|---|
Customer Id | id | s_user.id | /api/customers/2 |
Customer number | number | s_user_billingaddress.number | /api/customers/20003?useNumberAsId=true |
Model | Table |
---|---|
Shopware\Models\Customer\Customer | s_user |
Field | Type | Original Object |
---|---|---|
id | integer (primary key) | |
paymentId | integer (foreign key) | Payment |
groupKey | string (foreign key) | CustomerGroup |
shopId | string (foreign key) | Shop |
priceGroupId | integer (foreign key) | PriceGroup |
encoderName | string | |
hashPassword | string | |
active | boolean | |
string | ||
doubleOptInConfirmDate | date/time | |
doubleOptInEmailSentDate | date/time | |
doubleOptInRegister | boolean | |
firstLogin (date of creation) | date/time | |
lastLogin | date/time | |
accountMode | integer | |
confirmationKey | string | |
sessionId | string | |
newsletter | boolean | |
validation | string | |
affiliate | boolean | |
paymentPreset | integer | |
languageId | integer (foreign key) | |
referer | string | |
internalComment | string | |
failedLogins | integer | |
lockedUntil | date/time | |
attribute | object | CustomerAttribute |
billing | object | Billing |
paymentData | array | PaymentData |
shipping | object | Shipping |
debit | object | Debit |
For this operation no parameters are required. To get a list of all customers, simply query:
Model | Table |
---|---|
Shopware\Models\Customer\Customer | s_user |
This API call returns an array of elements, one for each customer. Each of these elements has the following structure:
Field | Type | Original Object |
---|---|---|
id | integer (primary key) | |
paymentId | integer (foreign key) | Payment |
groupKey | string (foreign key) | CustomerGroup |
shopId | string (foreign key) | Shop |
priceGroupId | integer (foreign key) | PriceGroup |
encoderName | string | |
hashPassword | string | |
active | boolean | |
string | ||
doubleOptInConfirmDate | date/time | |
doubleOptInEmailSentDate | date/time | |
doubleOptInRegister | boolean | |
firstLogin (date of creation) | date/time | |
lastLogin | date/time | |
accountMode | integer | |
confirmationKey | string | |
sessionId | string | |
newsletter | boolean | |
validation | string | |
affiliate | boolean | |
paymentPreset | integer | |
languageId | integer (foreign key) | |
referer | string | |
internalComment | string | |
failedLogins | integer | |
lockedUntil | date/time |
Appended to the above-mentioned list, you will also find the following data:
Field | Type | Comment |
---|---|---|
total | integer | The total number of category resources |
success | boolean | Indicates if the call was successful or not. |
To POST
or PUT
content, use the same data as provided in the GET operation. Only exceptions are for POST
as following:
Field | Type | Comment |
---|---|---|
sendOptinMail | boolean | Used to decide if an necessary opt-in confirmation mail will be sent |
To delete a customer's data, simply call the specified resource with the DELETE
operation, as the following example shows:
Replace the id
with the specific customer id.