ORO CRM API - 无法访问此类实体错误
我正在尝试使用 POST api/user api 请求添加用户并获得以下响应(通过 PHP):
403 - 访问被拒绝异常 - 无法访问此类实体
我不确定这意味着什么。我使用示例数据集和以下 php 代码 - 只是试图让基本功能正常工作:
$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>';
}
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>';
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
403 - 访问被拒绝异常意味着您的用户没有足够的访问权限。服务器理解该请求但拒绝满足它。授权不会有任何帮助,并且不应重复请求。
要授予添加新实体对象的访问权限,您应该在“系统/用户管理/角色”中将实体的“创建”权限设置为所需级别(全局/.../用户)
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"