# Customer not creating via REST API (customer resource)

**URL:** <https://forum.shopware.com/t/customer-not-creating-via-rest-api-customer-resource/67343>\
**Category:** International (English Only)\
**Tags:** programming\
**Created:** [1. Juni 2020 um 12:24 UTC](https://forum.shopware.com/t/customer-not-creating-via-rest-api-customer-resource/67343 "2020-06-01T12:24:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohsin94j](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mohsin94j](https://forum.shopware.com/u/mohsin94j)\
**Post date:** [1. Juni 2020 um 12:24 UTC](https://forum.shopware.com/t/customer-not-creating-via-rest-api-customer-resource/67343/1 "2020-06-01T12:24:47Z")

</div>

Hi community!

I am trying to create a customer via REST API like this from this link:&nbsp;[https://developers.shopware.com/developers-guide/rest-api/examples/customer/#example-3-create-a-customer-account](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();

```

&nbsp;

But it get this error

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/a/a662646a0dbecfebb56d01cd60b2167595ea3f16.png)

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.

&nbsp;

What am i doing wrong? Any leads?

---

<div class="post-metadata">

**Author:** ![datema-nt](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@datema-nt](https://forum.shopware.com/u/datema-nt)\
**Post date:** [21. Juni 2021 um 12:45 UTC](https://forum.shopware.com/t/customer-not-creating-via-rest-api-customer-resource/67343/2 "2021-06-21T12:45:03Z")

</div>

This is a dummyCustomer I created to be used for the customerManager and it worked out fine:

```auto
    private function provideDummyCustomer(): array {
        return [
            "sendOptinMail" => false,
            "number" => 'Custom_CustomerKey',
            "shopId" => 1,
            "groupKey" => "EK",

            "email" => "max@mustermann.de",
            "company" => "Max Company",
            "salutation"=> "mr",
            "firstname" => "Max",
            "lastname" => "Mustermann",
            "billing" => [
                "salutation"=> "mr",
                "firstname" => "Max",
                "lastname" => "Mustermann",
                "street" => "Musterstrasse 55",
                "city" => "Musterstadt",
                "zipcode" => "12345",
                "country" => 2
            ],
            "shipping" => [
                "salutation"=> "mr",
                "firstname" => "Max",
                "lastname" => "Mustermann",
                "street" => "Musterstrasse 55",
                "city" => "Musterstadt",
                "zipcode" => "12345",
                "country" => 2
            ],
            "attribute"=> ["customfield_test" => "customfield_content"]
        ];
    }

```
