Given a domain-specific external_id
, finds the existing Asset or creates a new Asset.
If external_id
is a Vehicle Identification Number (VIN), the Asset will be populated with the vehicle’s make
, model
, and year
.
Data that is not typically included in the asset model but that you would like added is passed in using an ‘extended’ property. Pass these values in like in the examples below using a JSON format.
$ curl -i \ -H "Accept: application/json; version=1" \ -H "Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjQyLCJpYXQiOjE0NjM2OTQ4MjN9.k48v-R-un93KdIXqp9Zi12JOGJCu8uibtrWjscFCTqc" \ -X POST \ -H 'Content-type: application/json' \ -d '{"asset": { "external_id": "NCC-1701D" , "extended": { "fleet_id": 4279 }}}' \ https://api.record360.com/api/assets HTTP/1.1 201 Created Content-Type: application/json; charset=utf-8 Cache-Control: max-age=0, private, must-revalidate { "asset": { "id": "42", "external_id": "NCC-1701D", ... "extended": { "fleet_id": 4279 } } }
$ curl -i \ -H "Accept: application/json; version=1" \ -H "Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjQyLCJpYXQiOjE0NjM2OTQ4MjN9.k48v-R-un93KdIXqp9Zi12JOGJCu8uibtrWjscFCTqc" \ -X POST \ -H 'Content-type: application/json' \ -d '{"asset": { "external_id": "WMWMF33519TW73378" , "extended": { "fleet_id": 4279 }}}' \ https://api.record360.com/api/assets HTTP/1.1 201 Created Content-Type: application/json; charset=utf-8 Cache-Control: max-age=0, private, must-revalidate { "asset": { "id": "43", "external_id": "WMWMF33519TW73378", "make": "MINI", "model": "Cooper", "year": 2009, "notations": {}, "photos": [], "videos": [], "signatures": [], "damages": [], ... "extended": { "fleet_id": 4279 } } }
Param name | Description |
---|---|
asset
required |
Asset attributes Validations:
|
asset[external_id]
required |
Domain-specific ID of the asset (e.g. VIN, serial number, registration number, etc) Validations:
|
asset[extended]
optional , nil allowed |
Extended data to be set if creating Validations:
|