【发布时间】:2019-05-21 05:54:38
【问题描述】:
我想将我的 SuiteCRM 升级到最新一代的 SuiteCRM 版本。由于我对现有的 SuiteCRM 使用 REST API4.1,并且知道我必须为最新一代的 SuiteCRM 版本使用 API v8,因此我在使用 PHP 版本 7.1 在 https 上运行的演示服务器上安装了带有虚拟数据的 SuiteCRM 7.11.3 .17.
在此之后,我通过在“Admin”-“OAuth2 Clients and Tokens”-“New Client Credentials Client”上导航,为“Client Credentials”授权类型生成了“client_id”和“client_secret”。
现在我正在检查 CRM API 以使用客户端凭据进行身份验证,并尝试使用以下代码获取会话,但没有得到任何数组或会话,也没有任何错误。
$ch = curl_init();
$header = array(
'Content-type: application/vnd.api+json',
'Accept: application/vnd.api+json',
);
$postStr = json_encode(array(
'grant_type' => 'client_credentials',
'client_id' => 'xxxxxxxxxx',
'client_secret' => 'xxxxxxxxxx'
));
$url = 'https://url/Api/access_token';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postStr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
$tab = json_decode($output);
print_r($tab);
curl_close($ch);
我尝试按照其中一篇文章的建议在 $postStr 中添加“'scope' => ''”,但没有返回任何内容。
有人可以指导一下吗?
【问题讨论】:
标签: suitecrm