PeterSGT
New Member
I installed the API using composer.
I can't add the client and I get this message.
EmsApi\Params Object
(
[_data:EmsApi\Params
rivate] => Array
(
[status] => error
[error] => Customer creation is disabled.
)
[_readOnly:EmsApi\Params
rivate] =>
)
In file:
/apps/common/models/Customer.php
I found such an entry:
// unsafe
['group_id, parent_id, status, email_details, inactiveAt', 'unsafe', 'on' => 'update-profile, register'],
I modified it by removing the group_id and parent _id, like this:
// unsafe
['status', 'unsafe', 'on' => 'update-profile, register'],
I add the client using code like this (I add it from the same server, but from a different website):
<?php
// require the setup which has registered the autoloader
require_once __DIR__ . '/setup.php';
// CREATE THE ENDPOINT
$endpoint = new EmsApi\Endpoint\Customers();
/*===================================================================================*/
// CREATE CUSTOMER
$response = $endpoint->create([
'customer' => [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@doe.com',
'password' => '12324pass',
'timezone' => 'Europe/Warsaw',
'birthDate' => '2000-01-01',
'group_id' => '4',
],
// company is optional, unless required from app settings
'company' => [
'name' => 'Company',
'country' => 'Country', // see the countries endpoint for available countries and their zones
'city' => 'City',
'zip_code' => '00000',
'address_1'=> 'Some Address',
],
]);
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
Is there anything else I can check why I can't add a client, using the API?
I can't add the client and I get this message.
EmsApi\Params Object
(
[_data:EmsApi\Params

(
[status] => error
[error] => Customer creation is disabled.
)
[_readOnly:EmsApi\Params

)
In file:
/apps/common/models/Customer.php
I found such an entry:
// unsafe
['group_id, parent_id, status, email_details, inactiveAt', 'unsafe', 'on' => 'update-profile, register'],
I modified it by removing the group_id and parent _id, like this:
// unsafe
['status', 'unsafe', 'on' => 'update-profile, register'],
I add the client using code like this (I add it from the same server, but from a different website):
<?php
// require the setup which has registered the autoloader
require_once __DIR__ . '/setup.php';
// CREATE THE ENDPOINT
$endpoint = new EmsApi\Endpoint\Customers();
/*===================================================================================*/
// CREATE CUSTOMER
$response = $endpoint->create([
'customer' => [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@doe.com',
'password' => '12324pass',
'timezone' => 'Europe/Warsaw',
'birthDate' => '2000-01-01',
'group_id' => '4',
],
// company is optional, unless required from app settings
'company' => [
'name' => 'Company',
'country' => 'Country', // see the countries endpoint for available countries and their zones
'city' => 'City',
'zip_code' => '00000',
'address_1'=> 'Some Address',
],
]);
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
Is there anything else I can check why I can't add a client, using the API?