You are not logged in.
Pages: 1
Hello
I am integrating user registration via API, the sequence is:
- /apirest.php/initSession
- /apirest.php/User
- /User/" . $userID . "/UserEmail
- /User/" . $userID . "/Profile_User
The user is being registered normally, but it is not being assigned to the Entity I need, my entity ID is 26 and the '/Profile_User' step is in the cURL code below
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://********/teste/apirest.php/User/62/Profile_User',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"input": {"users_id": ' . $userID . ',"entities_id":26,"is_recursive":0}}',
CURLOPT_HTTPHEADER => array(
'Session-Token: mjkndcn09o9*************dv',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
I saw in some codes people indicating the entity ID directly in '/User' but even placing the ID as in the json below with the key 'entities_id', the user was not receiving authorization for the entity.
$newUser = [
'input' => [
'name' => $frmUserName,
'realname' => $frmName,
'phone' => $frmPhone,
'password' => $frmPass,
'password2' => $frmPass,
'profiles_id' => $perfilID,
'entities_id' => 26,
'is_active' => 1,
]
];
The problem returned in /Profile_User is:
[
"ERROR_GLPI_ADD",
"You do not have permission to perform this action."
]
Offline
Pages: 1