/users

Update an existing user

Add External Ids

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

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

url = URI('https://api.keeptruckin.com/v1/users/<id>')

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 = {
    :email                        => nil,
    :first_name                   => "John1",
    :last_name                    => "Doe1",
    :phone                        => nil,
    :phone_ext                    => nil,
    :time_zone                    => nil,
    :carrier_name                 => nil,
    :carrier_street               => nil,
    :carrier_city                 => nil,
    :carrier_state                => nil,
    :carrier_zip                  => nil,
    :violation_alerts             => "1_hour",
    :terminal_street              => nil,
    :terminal_city                => nil,
    :terminal_state               => nil,
    :terminal_zip                 => nil,
    :exception_24_hour_restart    => false,
    :exception_8_hour_break       => false,
    :exception_wait_time          => false,
    :exception_short_haul         => false,
    :exception_ca_farm_school_bus => false,
    :export_combined              => true,
    :export_recap                 => true,
    :export_odometers             => true,
    :metric_units                 => false,
    :username                     => "john.doe.demo.fleet",
    :password                     => "password",
    :cycle                        => nil,
    :driver_company_id            => nil,
    :minute_logs                  => false,
    :duty_status                  => "off_duty",
    :eld_mode                     => "none",
    :drivers_license_number       => nil,
    :drivers_license_state        => nil,
    :yard_moves_enabled           => false,
    :personal_conveyance_enabled  => false,
    :manual_driving_enabled       => false,
    :role                         => "driver",
}

request.body = params.to_json

response = http.request(request)
puts response.read_body
Language
Authentication
Header
Click Try It! to start a request and see the response here!