/vehicles/:id

Update an existing vehicle

Add External Ids

To add one or more external ids follow the same format as mentioned in POST /v1/vehicles endpoint documentation.

require 'uri'
require 'net/http'
require 'json'

url = URI('https://api.keeptruckin.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                => "2017",
    :license_plate_state => "CA",
    :license_plate_number=> "5M37250",
    :metric_units        => false,
    :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
Language
Credentials
Header
Click Try It! to start a request and see the response here!