Creation of Sales Channel over the API

Hi,

i would like to create a Sales Channel over the API of Shopware 6.
For that i send the following POST request to the /api/sales-channel Endpoint:

{
    "typeId": "8a243080f92e4c719546314b577cf82b",
    "languageId": "2fbb5fe2e29a4d70aa5854ce7ce3e20b",
    "customerGroupId": "cfbd5018d38d41d8adca10d94fc8bdd6",
    "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
    "paymentMethodId": "79e557a3fe4646e9a0f9ceb45b2f5a7e",
    "countryId": "5dbe147703354d8692101a7cd4a2a6c8",
    "homeEnabled": true,
    "name": "Test Storefront",
    "shippingMethodId": "38456c729c3c4718abe2f7ab998b2527",
    "navigationCategoryId": "912c1bee85e547df9b5ade07aba0daa4",
    "accessKey": "******************************",
    "languages": [{"localeId": "3f9a85a234dd40c5b201afe4eb1e388d", "name": "English"}],
    "hreflangActive": false
}

If I send this request i get the following Error Message:

{
    "errors": [
        {
            "code": "SYSTEM__NO_GIVEN_DEFAULT_LANGUAGE_ID",
            "status": "400",
            "detail": "The sales channel with id \"bc284a7fceb949bca92756aaa962da1b\" does not have a default sales channel language id in the language list.",
            "template": "The sales channel with id \"{{ salesChannelId }}\" does not have a default sales channel language id in the language list.",
            "meta": {
                "parameters": {
                    "{{ salesChannelId }}": "bc284a7fceb949bca92756aaa962da1b"
                }
            },
            "source": {
                "pointer": "/"
            }
        }
    ]
}

Can somebody please help and tell me how to fix this problem?
Thank you!

Like it is written in the error message. You have to add the default language (id is in the error) to your sales channel.

Hi, i found a solution. You have to add the Ids of the languages you want for the storefront in the languages object. The default language is the language defined in the language id part.

{
    "typeId": "8a243080f92e4c719546314b577cf82b",
    "languageId": "2fbb5fe2e29a4d70aa5854ce7ce3e20b",
    "customerGroupId": "cfbd5018d38d41d8adca10d94fc8bdd6",
    "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
    "paymentMethodId": "79e557a3fe4646e9a0f9ceb45b2f5a7e",
    "countryId": "5dbe147703354d8692101a7cd4a2a6c8",
    "homeEnabled": true,
    "name": "Test Storefront",
    "shippingMethodId": "38456c729c3c4718abe2f7ab998b2527",
    "navigationCategoryId": "912c1bee85e547df9b5ade07aba0daa4",
    "accessKey": "SWUAUW1UZUXLWWEYD1ZDEWXHMW",
    "languages": [{"id": "2fbb5fe2e29a4d70aa5854ce7ce3e20b"}, {"id": "bf1757ea66b54de384768ba9943c4d5c"}],
    "hreflangActive": false
}

This is not really documented in the Endpoint Documentation, so it was hard to find out.