Push API: Vehicle Create

The OPS-COM Controller provides a simple JSON based API to integrate with. Clients use this API to directly feed vehicles into OPS-COM from other systems.  



Make sure you set the HTTP Content-Type header to be application/json.


Making API Requests

Raw Request

POST /api/OC_TOMA/v1/vehicles/push HTTP/1.1
Host: controller.operationscommander.io
Accept: application/json
Content-Type: application/json
Cache-Control: no-cache

{
	"apiToken": "YOUR-API-TOKEN",
	"plate": "PL8RDR",
  	"plateType": "Motorcycle",
  	"prov": "MA",
  	"make": "8",
  	"type": "3",
  	"colour": "red",
  	"year": "2011",
  	"vin": "8GKS1AKC7FR518845"
}

JavaScript Request

var request = new XMLHttpRequest();

request.open('POST', 'https://controller.operationscommander.io/api/OC_TOMA/v1/vehicles/push');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};


var body = {
	"apiToken": "YOUR-API-TOKEN",
	"plate": "PL8RDR",
  	"plateType": "Motorcycle",
  	"prov": "MA",
  	"make": "kia",
  	"type": "commercial",
  	"colour": "red",
  	"year": "2021",
  	"vin": "8GKS1AKC7FR518845"
}
request.send(JSON.stringify(body));

Request Object Attributes

AttributeTypeLimitsPossible NamesDescription
apiTokenString

50-character alphanumeric including dashes.

apiToken(Required) Your supplied API Token.
plateString50-character alphanumeric.

plate


(Required) The license plate.

plateTypeIDString

The ID of the VechiclePlateType record.

plateTypeID(One of plateTypeID or plateType is required) Your supplied VehiclePlateType identifier.
plateTypeString

50-character alphanumeric including dashes.

plateType(One of plateTypeID or plateType is required) The name of the plate type.
provIDString

The ID of the state/province.

provID(One of provID or prov is required) Your supplied state or province identifier.
provString

50-character alphanumeric including dashes

prov(One of provID or prov is required) The full name of the state/province or the corresponding postal abbreviation.
makeIDString

The ID of the vehicle make.

makeID(Optional) Your supplied vehicle make identifier.
makeString50-character alphanumeric including dashes

make

(Optional) The name of the vehicle manufacturer. 
typeIDString

The ID of the vehicle type.

typeID(Optional) Your supplied vehicle type identifier.
typeString

50-character alphanumeric including dashes

type(Optional) The name of the type of vehicle that you provided.
colourIDStringThe ID of the vehicle colour.colourID(Optional) Your supplied vehicle colour identifier.

colour

String

50-character alphanumeric including dashes

colour

(Optional) The name of a colour that you have provided..

yearString

4 digit year.

year

(Optional) The model year.

vinString25-characters

vin

(Optional) The vehicle identification number.



Successful Response

The response will be a json object. 

Content-Type: application/json

{
    "status": "success",
    "vehicle_id_id": "158",
    "warnings":["The vehicle colour name was too long and has been truncated."]
}