I'm trying to insert new user into espocrm from Api but I'm still receive this message "403 No create access for User.". Anyone know why? I can insert other entity for example Lead but with user I can't.
<?php require_once('EspoApiClient.php'); $url = 'http://myurlsite'; $apiKey = 'myapikey'; $client = new EspoApiClient($url); $client->setApiKey($apiKey); try { $response = $client->request('POST', 'User', [ 'firstName' => 'Gianni', 'lastName' => 'Gianni' , 'userName'=> 'Gianni', 'password'=> 'Gianni', 'passwordConfirm'=> 'Gianni', 'isActive'=> false, 'isAdmin'=> false ]); } catch (\Exception $e) { $errorCode = $e->getCode(); $errorM = $e->getMessage(); var_dump($errorCode.' '.$errorM); }
?>
Espocrm dosen't allow creaing user entity for non-admins by default.
If you have workflow, I suggest to let the api user create another custom entity from "Person" type, and then let workflow create the user for you from the submitted data.
Thanks for your feedback. I used an admin account to create user. Is it possible add via api an attribute link multiple? If yes, do you have an example?