- MyGeotab SDK
- API Runner Samples
- Navigate to the API Runner Calculate Fuel Usage sample.
- Click Run within the top toolbar.
- Put in the name of the device as it appears in the database within the Device name field from the Output pane.
- Click Calculate!
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:
- 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
- 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