put https://api.gomotive.com/v1/fuel_purchases/
Purpose: Use this API to update an existing fuel purchase. Note that you must pass important details such as vehicle_id
, driver_id
, jurisdiction
, fuel_type
, and others in the Body Parameters. Refer to the Body Parameters section for more info.
OAuth Token
require 'uri'
require 'net/http'
require 'json'
url = URI('https://api.gomotive.com/v1/fuel_purchases/1')
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 = {
:vehicle_id => 1,
:driver_id => 2,
:purchased_at => '2019-04-23',
:jurisdiction => 'AL',
:fuel_type => 'diesel',
:fuel => 13,
:fuel_unit => 'gal'
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
Response Parameters
id
- Type: Integer
- Description: The unique identifier for the fuel purchase.
offline_id
- Type: String
- Description: The offline identifier associated with the fuel purchase.
purchased_at
- Type: String (DateTime)
- Description: The date and time when the fuel was purchased.
jurisdiction
- Type: String
- Description: The jurisdiction where the fuel purchase occurred (e.g., state or region code).
fuel_type
- Type: String
- Description: The type of fuel purchased (e.g., diesel).
ref_no
- Type: String
- Description: The reference number for the fuel purchase.
vendor
- Type: String
- Description: The vendor from whom the fuel was purchased.
total_cost
- Type: Integer
- Description: The total cost of the fuel purchase.
currency
- Type: String
- Description: The currency used for the purchase (e.g., USD).
fuel
- Type: Integer
- Description: The amount of fuel purchased.
fuel_unit
- Type: String
- Description: The unit of measurement for the fuel (e.g., gal).
odometer
- Type: Integer or Null
- Description: The odometer reading at the time of fuel purchase.
odometer_unit
- Type: String
- Description: The unit of measurement for the odometer (e.g., mi).
receipt_upload_url
- Type: String or Null
- Description: The URL where the receipt can be downloaded.
receipt_filename
- Type: String or Null
- Description: The filename of the receipt.
uploader
- Type: Object
- Description: Information about the person who uploaded the fuel purchase.
- id: Integer — The unique identifier of the uploader.
- first_name: String — The first name of the uploader.
- last_name: String — The last name of the uploader.
- email: String — The email address of the uploader.
- role: String — The role of the uploader.
- deactivated_at: String or Null — The date and time when the uploader was deactivated.
vehicle
- Type: Object
- Description: Information about the vehicle associated with the fuel purchase.
- id: Integer — The unique identifier of the vehicle.
- number: String — The vehicle number.
- year: String — The year of the vehicle.
- make: String — The make of the vehicle.
- model: String — The model of the vehicle.
- vin: String — The Vehicle Identification Number.
- metric_units: Boolean — Indicates if the vehicle uses metric units.
driver
- Type: Object
- Description: Information about the driver associated with the fuel purchase.
- id: Integer — The unique identifier of the driver.
- first_name: String — The first name of the driver.
- last_name: String — The last name of the driver.
- username: String — The username of the driver.
- email: String — The email address of the driver.
- driver_company_id: String or Null — The ID of the driver's company.
- status: String — The status of the driver (e.g., active).
- role: String — The role of the driver.