ORO CRM API - 无法访问此类实体错误

发布于 2025-01-11 10:05:13 字数 1763 浏览 0 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故人爱我别走 2025-01-18 10:05:13

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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文