Avatar

Specify fromDate and toDate in PHP API Get call

0

Hello,

I am having trouble specifying a fromDate and a toDate in my PHP API Get call:

$test2 = $api->get("LogRecord", ["search" => ["device" => $sampleUserId], "fromDate" => "2018-11-01T00:00:00.000", "toDate" =>"2018-11-02T00:00:00.000", "resultsLimit" => 150]);

This returns in a proper array but the date is not being followed - instead it is pulling the first 150 results for the device.  For the sake of argument, the $sampleUserId variable references a valid Device ID, the only issue I am having is specifying the fromDate and toDate in the call.

Any help or guidance would be appreciated!

Thanks in advance!

 

Jeremiah Cook

Please sign in to leave a comment.

5 comments

0
Avatar

I did a little research and dug a little deeper.  I dropped the ResultsLimit parameter from the call since it was running before the search, so now I have this code snippet: 

$test2 = $api->get("LogRecord", ["search" => ["device" => ["id" => $sampleUserId], "fromDate" => $testDate, "toDate" => $test2Date]]);

The date functionality works now, but I can't seem to get it to search by device now. Suggestions?

Jeremiah

Jeremiah Cook 0 votes
0
Avatar

By the way, I updated mygeotab-php to v1.1.0 recently. Updated the documentation, fixed various small bugs and it's using a more improved HTTP client under the hood. Take a look.

Mike Murkovic 0 votes
0
Avatar

Now I'm working with GetAddresses:

$test4 = $api->call("GetAddresses", ["coordinates" => ["x" => $longitude, "y" => $latitude]]);

Do I have the properties correct?  I looked at the JavaScript for an example but I fear I may not have the call properties correct.

I have some other questions hanging but they may be better suited for an email conversation, is there a way that I can get your e-mail address for those discussions?

Thanks in advance,

Jeremiah

Jeremiah Cook 0 votes
0
Avatar

The coordinates property accepts an array of coordinate objects. So you're just missing [ ] around that x,y object.

If you're looking for more in-depth feedback, you can either post sanitized data here or open a new ticket with support.

Mike Murkovic 0 votes