[PHP] Can't POST to People Endpoint with Curl
Hi All,
I'm trying to create a timesheet via an API call.
Even though I am not passing an AuthToken and parameters, the error should say 'Provided authentication token is invalid', but the error I get is:
{"response":{"message":"Error occurred","uri":"/api/timetracker/createtimesheet","errors":{"code":7206,"message":"This URL can be invoked via POST method only"},"status":1}}
- $url = "http://people.zoho.com/people/api/timetracker/createtimesheet";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, array());
- $result = curl_exec($ch);
- curl_close($ch);
- echo $result;
- return $result;