Shopware store-api: Register customer funktioniert nicht

Hallo Ihr Lieben,

ich versuche vergebens einen neuen Customer über the store-api anzulegen. Ich erhalte immer den folgenden Response:

{
	"errors": [
		{
			"status": "412",
			"code": "FRAMEWORK__ROUTING_SALES_CHANNEL_NOT_FOUND",
			"title": "Precondition Failed",
			"detail": "No matching sales channel found.",
			"meta": {
				"parameters": []
			}
		}
	]
}

Wo liegt das Problem?

Hier ist der Request (den sw-access-key habe ich natürlich geändert :slight_smile: ):

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://www.myshop.de/store-api/account/register",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n    \"salutationId\": \"018ecee4b4d670a58218b7d733483b16\",\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\",\n    \"email\": \"john.doe@example.com\",\n    \"password\": \"ShopwareRocks!\",\n    \"acceptedDataProtection\": true,\n    \"billingAddress\": {\n        \"id\": \"131313b\",\n        \"customerId\": \"131313\",\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\",\n        \"street\": \"123 Shopware St\",\n        \"zipcode\": \"12345\",\n        \"city\": \"ShopCity\",\n        \"countryId\": \"018ecee4b4e67027a5ba8fdc057e2def\",\n        \"salutationId\": \"018ecee4b4d670a58218b7d733483b16\"\n    },\n    \"shippingAddress\": {\n        \"id\": \"131313s\",\n        \"customerId\": \"131313\",\n        \"firstName\": \"Joana\",\n        \"lastName\": \"Doey\",\n        \"street\": \"321 Shopware St\",\n        \"zipcode\": \"54321\",\n        \"city\": \"ClientCity\",\n        \"countryId\": \"018ecee4b4e67027a5ba8fdc057e2def\",\n        \"salutationId\": \"018ecee4b4d670a58218b7d733483b16\"\n    },\n    \"storefrontUrl\": \"https://www.myshop.de\"\n}",
  CURLOPT_HTTPHEADER => [
    "Accept: application/json",
    "Content-Type: application/json",
    "sw-access-key: 12345"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

Danke und viele Grüsse

Jens

Problem gelöst:

Ich habe den falschen API code verwendet (von den Integrationen). Hier benötigt man den API Code des Sales Channel!