How to use the Calculate Fuel Usage sample in the API Runner

Applies To

  • MyGeotab SDK
  • API Runner Samples

Procedure

  1. Navigate to the API Runner Calculate Fuel Usage sample.
  2. Click Run within the top toolbar.
  3. Put in the name of the device as it appears in the database within the Device name field from the Output pane.
  4. Click Calculate!

Additional Notes

The result of the calculation will show up within the Console pane.

Please note that by default the sample will pull fuel usage data for the last day. If you would like to adjust the time frame, follow the steps below to modify the code:

  1. Within the HTML pane, modify the fromDate by changing the code on line 71 from
    fromDate.setDate(fromDate.getDate() - 1);
    to
    fromDate.setDate("<timestamp>");
    where the timestamp follows this format: 2019-01-01T00:00:00.000Z
  2. To modify the toDate, add the following after line 71 
    toDate.setDate("<timestamp>");
    where the timestamp follows this format: 2019-01-01T00:00:00.000Z