Get started
Color

Import and export

Export Fleet data as CSV or JSON and import assets and meter readings with all-or-nothing checks.

For
OwnerFleet manager
Hosting
Any hosting
Devices
All devices
Business
Fleet

Checked against Pop Dispatch 0.1.0

You will be able to take your Fleet records out as CSV or JSON, and bring assets and meter readings in from a spreadsheet. An import checks every row first and writes nothing when any row has a problem.

Before you start #

  • Export is a read, so it works with or without the dispatch_fleet flag and in read-only license mode.
  • Import is a write, so it needs the flag (every Pop Dispatch license includes Fleet, and the 30-day trial includes it too) and an active license.
  • Import is open to the owner and operations manager group only.

Export steps #

  1. Choose what to export: assets, meter-readings, fuel, expenses, documents or advances.
  2. Send GET /fleet/export/:what. The default format is CSV. Add format=json for JSON.
  3. For CSV, read the answer as a record: file_name (for example fleet-assets.csv), content_type, rows and content. A file travels as text inside the JSON record, so save content as the file.
  4. For JSON, the answer is a list with one object per row.

Customer-owned vehicles are left out of the assets export. Voided rows stay in the other exports with their voided mark.

Formula guard #

A spreadsheet can run a cell that starts with =, +, - or @. When a CSV cell starts with one of those characters (or a tab or carriage return), Pop Dispatch puts an apostrophe in front, so the cell opens as text.

Import steps #

  1. Pick assets or meter-readings.
  2. Send POST /fleet/import/:what with one of: a JSON array of row objects, {"rows": [...]}, or {"csv": "..."} with the CSV text and a header line. Send 1 to 5000 rows.
  3. For assets, give each row a unit_no (required, unique). You can add label, kind (vehicle, trailer or equipment), year, make, model, vin, registration_no, fuel_type, odometer and odometer_unit (km or mi).
  4. For meter-readings, give each row an asset_id and a value. You can add meter (distance or hours), read_at as an ISO 8601 date-time, and note. A distance is in the asset's unit and an hours value in hours.
  5. Read the answer: imported rows and flagged_for_review.

All or nothing #

Every row is checked before any row is written. When any row has a problem, the answer is validation_failed with a rows list of {row, error} entries. Row numbers start at 1. Nothing is imported. Fix the listed rows and send the whole file again.

Regression flags #

A meter reading below the one before it is accepted and flagged regression. The flagged reading adds nothing to the asset's lifetime distance. The import answer counts them in flagged_for_review so a person can confirm or correct each one in the meter log.

Technical details
  • Imported assets are operator-owned. An asset odometer on a row writes a reading with source import.
  • Imported meter readings carry source import. A distance is stored in meters, hours in hundredths.
  • A unit_no already in use, or repeated inside the file, is a row problem.
  • Each import writes one audit entry with the kind and the row count.

If something goes wrong #

  • feature_not_licensed (403), licence_read_only (403): import is blocked. Export keeps working.
  • validation_failed (422): the body holds no rows, holds more than 5000, or rows have problems (see the rows list). format must be csv or json.
  • not_found (404): the name after /export/ or /import/ falls outside the lists above.
  • Row errors such as "unit_no is already used", "odometer_unit must be km or mi" and "asset_id does not match an asset": correct that row in the file and send it again.