【问题标题】:SuiteCRM api v8 not giving any responseSuiteCRM api v8 没有给出任何响应
【发布时间】: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


    【解决方案1】:

    确保您首先生成您的私钥和公钥,否则它将不起作用。 https://docs.suitecrm.com/developer/api/version-8/json-api/#_before_you_start_calling_endpoints

    您的帖子变量也应该在正文中。

    【讨论】:

    • 而不是发布链接,最好在答案中添加相关代码。
    猜你喜欢
    • 2012-06-04
    • 2021-05-07
    • 2022-01-04
    • 2018-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-24
    • 1970-01-01
    相关资源
    最近更新 更多