API returns wrong salutation for customer

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.

This is now irrelevant to me, since I can fetch the data I need better using the api/search/customer API anyway.

Hi,
it seems, that this is still relevant.
I’m currently working on an App, which is updating customers salutationId. This change takes effect, the salutationId is changed, but the associated salutation payload shows the wrong salutation.
But when i’m looking into the details of the customer in Backend, the salutation is shown correct.
I’m using Shopware 6.4.14.0 (updating my development environment needs some time, thatswhy im not on the current 6.4.18.0)

I think this is a bug and should be addressed. I think, in the meantime i have to deal with it and fetch all available salutations separate and find the correct in there. Switching to /api/search is no option for me, since i have to use the /store-api