Zoho Projects API时间表 - 常规错误6500 - 添加时间条目

时间:2018-02-21 20:23:16

标签: php rest post yii2 zoho

整合:Active Collab - Zoho Projects
我正在尝试使用API​​在Zoho Projects的任务下创建一个新的Time条目。

我已经同步了任务和项目。但是我很难创造一个时间条目。 我已经尝试过使用php和邮递员。在两端我得到同样的错误:

Response HTTP Status Code : 400
{"error":{"code":6500,"message":"General Error"}}

这是我的要求:

$request_parameters = array(
                'authtoken'   => 'APITOKEN',
                'date'        => '02-20-2018',
                'bill_status' => 'Billable',
                'hours'       => '02:22'
);

这些作为URL参数传递。

如果我更改了错误代码更改的任何参数 我使用了Zoho Project documentation page中提供的示例: 不确定是什么。

这是请求网址:

https://projectsapi.zoho.com/restapi/portal/hidden_portal_id/projects/1167980000000355033/tasks/1167980000000355033/logs/?authtoken=hidden_api_token&date=02-20-2018&bill_status=Billable&hours=02%3A22

I've found a similar thread but could not figure it out based on that

感谢。 这是完整的代码:

/* Set the Request Url (without Parameters) here */
$request_url = 'https://projectsapi.zoho.com/restapi/portal/hidden_portal_id/projects/'.$endpoint;

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

$request_parameters = array(
        'authtoken'   => 'hidden_api_key',
        'date'        => '02-20-2018',
        'bill_status' => 'Billable',
        'hours'       => '02:22'
    );

curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request_parameters));

//I've added this line because I've found a similar error 6500 thread see the link above
$request_url .=  '?'. http_build_query($request_parameters);

/* Here you can set the Response Content Type */
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));

/* Let's give the Request Url to Curl */
curl_setopt($ch, CURLOPT_URL, $request_url);

/* Allows Curl to connect to an API server through HTTPS */
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
d($request_parameters,$request_url);

/* Let's get the Response ! */
$response = curl_exec($ch);

$response_info = curl_getinfo($ch);

/* Don't forget to close Curl */
curl_close($ch);

0 个答案:

没有答案