Hi community!
I am trying to create a customer via REST API like this from this link: https://developers.shopware.com/developers-guide/rest-api/examples/customer/#example-3-create-a-customer-account
$data = [
'email' => 'meier@mail.de',
'firstname' => 'Max',
'lastname' => 'Meier',
'salutation' => 'mr',
'billing' => [
'firstname' => 'Max',
'lastname' => 'Meier',
'salutation' => 'mr',
'street' => 'Musterstrasse 55',
'city' => 'Sch\\u00f6ppingen',
'zipcode' => '48624',
'country' => 2
],
];
$manager = new \ Shopware \ Components \ Api \ Manager ();
$customerManager = $manager->getResource('Customer');
$response = $customerManager->create($data);
echo "";
echo "";
print_r($response);
echo PHP_EOL;
die();
But it get this error
So i added ‘shopId’ in the array above like this:
$data = [
'email' => 'meier@mail.de',
'firstname' => 'Max',
'lastname' => 'Meier',
'salutation' => 'mr',
'billing' => [
'firstname' => 'Max',
'lastname' => 'Meier',
'salutation' => 'mr',
'street' => 'Musterstrasse 55',
'city' => 'Sch\\u00f6ppingen',
'zipcode' => '48624',
'country' => 2,
],
'shopId' => 1
];
Now it does not give that error, but also does not create a customer. i also tried putting shopId in string as well like this: ‘shopId’ => ‘1’ but same result - not creating a customer.
What am i doing wrong? Any leads?