Hi,
I just started working with the Shopware 6 API. I’m trying to fetch all customer data from a shop (to load it into another system). As part of this I need to know each customer’s salutation. But the salutation included in the API response is wrong.
Below is an example (this is using the Shopware 6 demo data, so no sensitive data here).
Demo customer „Stephan Tiedemann“ has the salutation „Mr.“, as shown in the store admin:
Meanwhile, calling „GET /api/customer/“ gives a result like this:
{
"total": 25,
"data": [
{
"id": "d37841436e254701abc54d472f954c3b",
// this salutationId is right:
"salutationId": "d5e543063dd642b48ef94b02d68e5785",
"firstName": "Stephan",
"lastName": "Tiedemann",
// ... other fields ...
"salutation": {
// this salutation dict is all wrong:
"salutationKey": "undefined",
"displayName": "",
"letterName": "",
"translations": null,
"customers": null,
"customerAddresses": null,
"orderCustomers": null,
"orderAddresses": null,
"newsletterRecipients": null,
"_uniqueIdentifier": "ed643807c9f84cc8b50132ea3ccb1c3b",
"versionId": null,
"translated": {
"displayName": "",
"letterName": "",
"customFields": []
},
"createdAt": "2021-09-01T12:36:56.012+00:00",
"updatedAt": null,
"extensions": {
"foreignKeys": {
"apiAlias": null,
"extensions": []
}
},
"id": "ed643807c9f84cc8b50132ea3ccb1c3b",
"customFields": null,
"apiAlias": "salutation"
},
},
// ... 24 other customers ...
],
"aggregations": []
}
The „salutation“ dict is the same for each customer, it always contains „undefined“.
Meanwhile the „salutationId“ is different for different customers, and points to the actual correct salutation („mr“). So it’s possible to find the correct salutation, but the one included in the customer payload is wrong.
Note that I’m using a freshly created Shopware 6 Cloud store.
Thought this was worth reporting. I wonder if this is a bug or if I’m using the API wrong.