# API returns wrong salutation for customer

**URL:** <https://forum.shopware.com/t/api-returns-wrong-salutation-for-customer/90733>\
**Category:** Shopware 6 (English)\
**Tags:** programming\
**Created:** [6. Oktober 2021 um 14:26 UTC](https://forum.shopware.com/t/api-returns-wrong-salutation-for-customer/90733 "2021-10-06T14:26:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joonas\_N](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@Joonas\_N](https://forum.shopware.com/u/Joonas_N)\
**Post date:** [6. Oktober 2021 um 14:26 UTC](https://forum.shopware.com/t/api-returns-wrong-salutation-for-customer/90733/1 "2021-10-06T14:26:14Z")

</div>

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:

 ![Screenshot 2021-10-06 at 17.18.11](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/c/c977534438f5151a775d0d3e054ddf3a8b75e63c.png)

Meanwhile, calling „GET /api/customer/“ gives a result like this:

```auto
{
    "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.

---

<div class="post-metadata">

**Author:** ![Joonas\_N](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@Joonas\_N](https://forum.shopware.com/u/Joonas_N)\
**Post date:** [6. Oktober 2021 um 17:51 UTC](https://forum.shopware.com/t/api-returns-wrong-salutation-for-customer/90733/2 "2021-10-06T17:51:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobertK](https://avatars.discourse-cdn.com/v4/letter/r/ea666f/32.png) [@RobertK](https://forum.shopware.com/u/RobertK)\
**Post date:** [17. Januar 2023 um 14:57 UTC](https://forum.shopware.com/t/api-returns-wrong-salutation-for-customer/90733/3 "2023-01-17T14:57:57Z")

</div>

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
