Fleetio
Fleetio Integration Documentation
Overview
This document provides an overview of the Fleetio integration, detailing the endpoints used, fields sent for expense entries, the daily vehicle fetch process, and the logging system for active integrations and tolls.
Endpoints Used
Vehicle Endpoints
- Fetch All Vehicles:
GET https://secure.fleetio.com/api/v1/vehicles
- Fetch Archived Vehicles:
GET https://secure.fleetio.com/api/v1/vehicles/archived
Webhook Endpoints
- Create Webhook:
POST https://secure.fleetio.com/api/v1/webhooks
- Get Webhooks:
GET https://secure.fleetio.com/api/v1/webhooks
- Delete Webhook:
DELETE https://secure.fleetio.com/api/v1/webhooks/{id}
Expense Entry Endpoints
- Expense Entry:
POST https://secure.fleetio.com/api/v1/expense_entries
Expense Entry Fields
When creating expense entries, the following fields are sent. This includes custom fields that must be present on the Fleetio side:
Common Fields
- expense_entry_type_id: The ID of the expense entry type.
- vehicle_id: The ID of the vehicle in Fleetio.
- occurred_at: The date and time when the expense occurred.
- total_amount_cents: The total amount of the expense in cents.
- total_amount: The total amount of the expense.
Custom Fields
- plate_number: The plate number of the vehicle.
- plate_state: The state of the vehicle’s license plate.
- ticket_id: The ID of the ticket.
- pin: The PIN associated with the vehicle.
- fleet_liable: Indicates whether the fleet is liable.
- transaction_date_time: The date and time of the transaction.
- violation: The violation number (for parking).
- notice_number: The notice number (for parking).
- issuing_authority: The issuing authority of the ticket.
- vehicle_number: The vehicle number.
- pdf: URL to the PDF of the ticket (if available).
- fleetit_fee: The fee charged by Fleetio (for tolls).
- posting_date: The posting date of the transaction (for tolls).
- exit_plaza: The exit plaza (for tolls).
- cash_cost: The cash cost associated with the toll (for tolls).
- agency: The agency managing the toll (for tolls).
Daily Vehicle Fetch Process
Vehicles are fetched from Fleetio once a day. The process involves fetching both active and archived vehicles using the specified endpoints. The integration checks for updates and new vehicles, processing and updating the local database accordingly.
Fetching Vehicles
- Fetch Active Vehicles: The system fetches all active vehicles using the
https://secure.fleetio.com/api/v1/vehicles
endpoint. - Fetch Archived Vehicles: The system fetches all archived vehicles using the
https://secure.fleetio.com/api/v1/vehicles/archived
endpoint.
Logging System
Active Integration Logs
Logs for active integrations are created to track the daily vehicle fetch process. These logs include details about the number of vehicles fetched, added, updated, and any errors encountered.
Toll Logs
After sending a toll, logs are created for each toll transaction. These logs include:
- Timestamp: When the log was created.
- Action: Description of the action taken (e.g., “Send toll to Fleetio”).
- Direction: Indicates whether the action was “sending” or “receiving”.
- Success: Indicates whether the action was successful.
- Response: Details of the response from Fleetio.
- Payload: The data sent in the request.
- Entity ID: The ID of the toll entity.
- Entity Type: The type of entity (e.g., “TICKET”, “PARKING”).