put https://api.gomotive.com/v1/assets/
Purpose: Use this API to update the information of an asset. Motive allows you to update the following information for an asset:
- External ID attributes
- Status
- Group IDs
- Lease information
- Corresponding Gateway ID
- VIN
- Availability Details
To add an external ID to the asset, take the following steps:
- Add the following request to the request body:
{
"number":"toyota_32",
# other attributes for a asset
...
...
...
# add external id for asset
"external_ids_attributes":[
{
"external_id":"987",
"integration_name":"generic_tms"
}
]
}
require 'uri'
require 'net/http'
require 'json'
url = URI('https://api.gomotive.com/v1/assets/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 = {
external_id_attributes: [{external_id: 456, integration_name: 'tmw_tmt'}]
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
NOTE
The name of the external ID is stored as
integration_name
. Ensure that every time you add an external ID, you must also mention the integration name as they are used together and their values are unique.
Response Parameters
asset
- Type: Object
- Description: Denotes the object that contains the details of the asset that we are creating.
id
- Type: Number
- Description: The unique identifier assigned to the asset.
name
- Type: String
- Description: The name of the asset.
status
- Type: String
- Description: The status of the asset (e.g., "active").
type
- Type: String
- Description: The type of the asset (e.g., "flatbed").
custom_type
- Type: String
- Description: The custom type of the asset, if any.
vin
- Type: String
- Description: The Vehicle Identification Number (VIN) of the asset.
license_plate_state
- Type: String
- Description: The state of the asset's license plate.
license_plate_number
- Type: String
- Description: The license plate number of the asset.
make
- Type: String
- Description: The manufacturer of the asset.
model
- Type: String
- Description: The model of the asset.
year
- Type: String
- Description: The year the asset was manufactured.
axle
- Type: String
- Description: The axle information of the asset, if any.
weight_metric_units
- Type: Boolean
- Description: Indicates if the asset's weight is measured in metric units.
length_metric_units
- Type: Boolean
- Description: Indicates if the asset's length is measured in metric units.
leased
- Type: Boolean
- Description: Indicates if the asset is leased.
notes
- Type: String
- Description: Additional notes about the asset.
group_ids
- Type: Array
- Description: A list of all the group IDs assigned to the asset.
length
- Type: String
- Description: The length of the asset.
gvwr
- Type: String
- Description: Gross Vehicle Weight Rating of the asset.
gawr
- Type: String
- Description: Gross Axle Weight Rating of the asset.
asset_gateway
- Type: String
- Description: Information about the asset gateway, if any.
external_ids
- Type: Array
- Description: A list of external identifiers associated with the asset.
integration_name
- Type: String
- Description: The name of the integration with which the external ID is associated.
availability_details
- Type: Object
- Description: Contains the availability details object. This object denotes the availability of the asset for a dispatch.
availability_status
- Type: String
- Description: Denotes the availability status of the asset. Allowed values are “out_of_service” or “in_service”.
out_of_service_reason
- Type: String
- Description: Denotes the reason for the asset being out of service.
updated_at
- Type: DateTime
- Description: Denotes the date and time when the availability status of the asset was updated.
additional_note
- Type: String
- Description: Denotes any comments or notes added for updating the availability of the asset. For example, “This asset is scheduled for maintenance.”
custom_driver_app_warning_prompt
- Type: String
- Description: This denotes the prompt message that drivers see on their driver_app. This prompt can be used to inform the driver about the status of the asset or communicate any specific instructions. For example, “Asset is under maintenance, do not operate.”
updated_by_user
- Type: Object
- Description: Object containing the details of the user who updated the availability status of the asset.
id
- Type: Int
- Description: The ID of the user who updated the availability status of the asset.
first_name
- Type: String
- Description: First name of the user who updated the status of the asset.
last_name
- Type: String
- Description: Last name of the user who updated the status of the asset.
user_name
- Type: String
- Description: Company username of the person who updated the status.
email
- Type: String
- Description: Email address of the user.
company_reference_id
- Type: Int
- Description: The company ID of the user as per the internal company records.
status
- Type: String
- Description: The status of the user who updated the availability of the asset.
role
- Type: String
- Description: The role of the user who updated the availability status of the asset.