/meter_entries

Creates a new meter entry for a vehicle.

Fleetio requires that odometer updates never go backwards since odometers are incremental in real life. This allows Fleetio to make reports that accurately reflect reality since we are not dealing with impossible math situations. As such, this introduces a few considerations when updating meter entries via the API. Let's say that we have a vehicle with the following odometer readings:

28802880

If we realized that the reading on February 1st should be 181,500 miles rather than 181,000 miles, we can update this via the API without voiding it.

curl https://secure.fleetio.com/api/v1/meter_entries/16779437 --request PATCH --header 'Authorization: Token token="12345abcxyzhasggwllsirusy12345"' --header "Account-Token: 12345hbl78b" --header "Content-Type: application/json" --data '{"vehicle_id": "28865", "date": "2018-02-01", "value": "181500"}'
28802880

The only time we're going to run into an issue is if we start to get things out of order. So let's say that we wanted to set the reading in February 1st to be 182,500 miles, which is greater than the reading on March 1st, which is 182,000 miles. Now we have a problem because its impossible for the odometer to go backwards like that. Fleetio can't do its reporting and math on impossible values because the math simply doesn't work.

curl https://secure.fleetio.com/api/v1/meter_entries/16779437 --request PATCH --header 'Authorization: Token token="12345abcxyzhasggwllsirusy12345"' --header "Account-Token: 12345hbl78b" --header "Content-Type: application/json" --data '{"vehicle_id": "28865", "date": "2018-02-01", "value": "182500"}'
=> {"errors":{"value":["must be between 180,000 and 182,000 or marked as void"]}}

The quick and dirty way is to just set the February 1st meter entry as void and skip the reporting.

curl https://secure.fleetio.com/api/v1/meter_entries/16779437 --request PATCH --header 'Authorization: Token token="12345abcxyzhasggwllsirusy12345"' --header "Account-Token: 12345hbl78b" --header "Content-Type: application/json" --data '{"vehicle_id": "28865", "date": "2018-02-01", "value": "182500", "void": "true"}'
28802880

But if you want the reporting to remain intact, there is a workaround.

The solution is to edit the odometer readings in an order so that the odometer is never out of incremental order. For example, I would edit the reading on March 1st to be 183,000 miles first, and then I could edit the reading on February 1st to be 182,500 miles. Since we maintain the proper logic without ever getting into an impossible math situation, there is no need to void the meter entries, and you keep your reporting intact.

curl https://secure.fleetio.com/api/v1/meter_entries/16779438 --request PATCH --header 'Authorization: Token token="12345abcxyzhasggwllsirusy12345"' --header "Account-Token: 12345hbl78b" --header "Content-Type: application/json" --data '{"vehicle_id": "28865", "date": "2018-03-01", "value": "183000"}'

curl https://secure.fleetio.com/api/v1/meter_entries/16779437 --request PATCH --header 'Authorization: Token token="12345abcxyzhasggwllsirusy12345"' --header "Account-Token: 12345hbl78b"  --header "Content-Type: application/json" --data '{"vehicle_id": "28865", "date": "2018-02-01", "value": "182500"}'
28802880

Now you know about editing odometers via the API. Happy metering!

Language
Authentication
Click Try It! to start a request and see the response here!