Purpose: Use this API to update a vehicle on the Motive Fleet Dashboard for your organisation. It is important to note that whenever you update a vehicle, a vehicle gateway must be installed, and you must assign the vehicle gateway to it, so that you can track the vehicle and also get the respective metrics.
NOTE
External IDs are the unique identifiers assigned by an external system or an integration. When you enter the external ID, you must also mention the integration it is associated with. The combination of the external ID and the integration name will always be unique. Below are the steps that you must take in order to add an external ID to the endpoint.
Apart from adding the following to the request body, you must also add the
external_id
and theintegration_name
in the Body Parameters. Refer to the Body Parameters section for more info.
External IDs
To add an external ID to the vehicle, take the following steps:
-
Add the following request to the body:
-
{ "number":"toyota_32", # other attributes for a vehicle ... ... ... # add external id for vehicle "external_ids_attributes":[ { "external_id":"987", "integration_name":"generic_tms" } ] }
-
require 'uri' require 'net/http' require 'json' url = URI('https://api.gomotive.com/v1/vehicles/4') http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request['Authorization'] = "Bearer <OAUTH_TOKEN>" request['Content-Type'] = 'application/json' params = { :company_id => 1, :number => "Demo Vehicle", :status => "active", :ifta => true, :vin => "WP0AB2966NS458669", :make => "Demo", :model => "Vehicle", :year => "2016", :license_plate_state => "CA", :license_plate_number => "5M37250", :metric_units => false, :notes => "Demo Notes", :fuel_type => "diesel", :eld_device => { :id => 2, :identifier => "000074802542164638439715893965", :model => "lbb-1" }, :current_driver => { :id => 11, :first_name => "Demo", :last_name => "Driver", :username => "demo_driver", :email => nil, :driver_company_id => nil, :status => "active", :role => "driver" } } request.body = params.to_json response = http.request(request) puts response.read_body
Response Parameters
vehicle
- Type: Object
- Description: Contains details of the vehicle.
id
- Type: Integer
- Description: Unique identifier for the vehicle.
company_id
- Type: Integer
- Description: ID of the company that owns the vehicle.
number
- Type: String
- Description: The vehicle's assigned number or name.
status
- Type: String
- Description: Current status of the vehicle (e.g.,
active
).
ifta
- Type: Boolean
- Description: Indicates whether the vehicle is IFTA-registered.
vin
- Type: String
- Description: The Vehicle Identification Number (VIN).
make
- Type: String
- Description: The make of the vehicle.
model
- Type: String
- Description: The model of the vehicle.
year
- Type: String
- Description: The manufacturing year of the vehicle.
license_plate_state
- Type: String
- Description: The state where the vehicle's license plate is registered.
license_plate_number
- Type: String
- Description: The vehicle's license plate number.
metric_units
- Type: Boolean
- Description: Indicates if the vehicle uses metric units.
fuel_type
- Type: String
- Description: The type of fuel used by the vehicle (e.g.,
diesel
).
group_ids
- Type: Array of Integers
- Description: List of group IDs associated with the vehicle.
prevent_auto_odometer_entry
- Type: Boolean
- Description: Indicates if auto-odometer entry is disabled.
created_at
- Type: String (Date-Time)
- Description: The timestamp when the vehicle was created.
updated_at
- Type: String (Date-Time)
- Description: The timestamp when the vehicle was last updated.
eld_device
- Type: Object
- Description: Information about the vehicle' gateway.
id
- Type: Integer
- Description: The ID of the vehicle gateway.
identifier
- Type: String
- Description: Unique identifier for the vehicle gateway.
model
- Type: String
- Description: The model of the vehicle gateway.
current_driver
- Type: Object
- Description: Information about the vehicle's current driver.
id
- Type: Integer
- Description: Driver's unique identifier.
first_name
- Type: String
- Description: Driver's first name.
last_name
- Type: String
- Description: Driver's last name.
username
- Type: String
- Description: Driver's username.
email
- Type: String
- Description: Driver's email address.
driver_company_id
- Type: Integer
- Description: Driver's company ID.
status
- Type: String
- Description: Current status of the driver (e.g.,
active
).
role
- Type: String
- Description: The driver's role (e.g.,
driver
).
external_ids
- Type: Array of Objects
- Description: List of external system IDs associated with the vehicle.