Avatar

Geotab PHP search by user id

0

Hello, 

Im attemping to retreive the total amount of hours each driver drove per day using PHP.

This is what I have so far, but cant get it to search by user id. Any help is appreciated.

<?php
require __DIR__ . '/../vendor/autoload.php';

$username = '';
$password = '';
$database = '';
$server = 'my.geotab.com';

$lastWeek = new DateTime();
$lastWeek->modify("-1 week");

$api = new Geotab\API($username, $password, $database, $server);
$api->authenticate();

$api->get("DutyStatusLog", [
"search" => [
"driver" => ["id" => "bE4"],
"status" => ["ON", "D"],
"fromDate" => "2018-10-01T05:00:00.000Z",
"toDate" => "2018-11-01T05:59:59.000Z"
], "resultsLimit" => 2], function ($results) {
var_dump($results);
}, function ($error) {
var_dump($error);
});

?>

Adolfo Alonso

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Adolfo,

It depends on the "timeline" you're looking for. If you're looking for just drivers' "standard" HOS logs, then filter by: D, ON, SB, OFF, WT. The other logs (e.g. Engine_Powerup) don't impact the timeline of the users' status events.

p.s. Take a look at the new updates to mygeotab-php library. v1.1.0 is out. Any bugs you find - report those to github.com/geotab/mygeotab-php

Mike Murkovic 0 votes