Rest API 给出 NULL 作为响应
Rest API giving NULL in response
我正在与 rest API
合作。我正在使用 zoho API's 拨打电话。在 yii2
工作,我正在尝试调用 GET
API,它会提供有关我的项目的一些详细信息。
/* Set the Request Url (without Parameters) here */
$request_url = 'https://projectsapi.zoho.com/restapi/portal/[PORTALID]/projects/[PROJECTID]/bugs/defaultfields/';
$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('authtoken' => 'key')); // here i am using key but in actual i am putting the real key value
$curl_response = curl_exec($ch);
$json = json_decode($curl_response);
var_dump($json);
exit();
通过 POSTMAN
访问它,当我 运行 这个调用时,它会给我 NULL
作为响应。 PHP示例here中提到的方法我也试过了。但这对我也不起作用。
我一定是漏掉了一些我不知道的东西。
任何帮助将不胜感激。
尝试检查您的 headers 并确保您通过了示例授权、内容类型等的所有必填字段。
我正在与 rest API
合作。我正在使用 zoho API's 拨打电话。在 yii2
工作,我正在尝试调用 GET
API,它会提供有关我的项目的一些详细信息。
/* Set the Request Url (without Parameters) here */
$request_url = 'https://projectsapi.zoho.com/restapi/portal/[PORTALID]/projects/[PROJECTID]/bugs/defaultfields/';
$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('authtoken' => 'key')); // here i am using key but in actual i am putting the real key value
$curl_response = curl_exec($ch);
$json = json_decode($curl_response);
var_dump($json);
exit();
通过 POSTMAN
访问它,当我 运行 这个调用时,它会给我 NULL
作为响应。 PHP示例here中提到的方法我也试过了。但这对我也不起作用。
我一定是漏掉了一些我不知道的东西。
任何帮助将不胜感激。
尝试检查您的 headers 并确保您通过了示例授权、内容类型等的所有必填字段。