Reputation: 1
I'm trying to add a user using the POST api/user api request and get the following response (via PHP):
403 - access denied exception - No access to this type of entities
I'm not sure what this means. I'm using the example data set for this with the following php code - just trying to get the basic functionality working:
$ch = curl_init();
$header = array();
$post = array(
'data' => array(
"type"=>"users",
"attributes"=>array(
"username"=>"testuser",
"email"=> "[email protected]",
"firstName"=> "Bob",
"lastName"=> "Fedeson",
"password"=> "Password000!"
),
"relationships"=>array(
"owner"=>array(
"data"=>array(
"type"=> "businessunits",
"id"=> "1"
)
)
),
)
);
$header[] = 'Accept: application/vnd.api+json';
$header[] = 'Authorization: WSSE profile="UsernameToken"';
$header[] = $wsseHeader;
curl_setopt($ch, CURLOPT_URL,"https://[full url here]/api/users");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$rest = curl_exec($ch);
if($rest === false)
{
echo 'Curl error: ' . curl_error($ch);
}else{
$rest = json_decode($rest, true);
echo '<pre>';
var_dump($rest);
echo '</pre>';
}
Upvotes: 0
Views: 85
Reputation: 46
403 - access denied exception means that your user has not enough access permissions. The server understood the request but is refusing to fulfill it. The authorization will not help and the request SHOULD NOT be repeated.
To grant access to add new entity objects you should set "Create" permission of your entity to the required level (global/.../user) in the "System/User Management/Roles"
Upvotes: 0