Rincewind
Rincewind

Reputation: 26

Clio api V4 updated since paramter not working

New to Clio api but I am trying to use the Clio Api to pull a list of activities by using the below code. All I get in response is an empty string, no error or and error number is zero. Without the date I get a list of all my activities.

 $header = 'Authorization: bearer ' . $this->token;
 $ch = curl_init();
// date hardcoded for sample
 $url=   $this->base . $this->API_version . "activities?updated_since=2012-10-12T14:15:16 -0500" ;

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));

Upvotes: 0

Views: 494

Answers (3)

Matthew Hoag
Matthew Hoag

Reputation: 64

Any dates used in Clio API calls need to be provided as a string as specified in the REST endpoint documentation here:
https://app.clio.com/api/v4/documentation

For your specific model: Activities the documentation is here: https://app.clio.com/api/v4/documentation#tag/Activities

updated_since [string] < date-time > Filter Activity records to those having the updated_at field after a specific time. (Expects an ISO-8601 timestamp).

The following are ISO-8601 compliant timestamps for created since:

created_since=2017-12-29T16:27:15+01:00

created_since=2017-12-29T16:27:15Z

This is not ISO-8601 compliant.

created_since=2017-12-29T16:27:15 +01:00

(space)[ASCII-32] character is not accepted in an ISO-8601 string

https://en.wikipedia.org/wiki/ISO_8601

Upvotes: 1

Rincewind
Rincewind

Reputation: 26

The solution to this is to drop the timezone ' -0500' at the end of the date. Once dropped it works fine.

Upvotes: 0

jbalter
jbalter

Reputation: 59

try using curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);

Also what is your full URL?

Upvotes: 0

Related Questions