iotoms Docs

Create a vehicle

POST
/api/v1/ops/vehicles

Adds a new vehicle to the fleet and returns it. The vehicle number must be unique. A van stock location is created for the vehicle at the same time, so stock can be loaded onto it.

How to use it

  1. Send vehicleNumber (unique), vehicleType and optionally a label, status, odometer and notes.
  2. The vehicle is created (ACTIVE by default) together with its own van stock location, visible in List inventory locations.
  3. Assign a driver or salesperson with Assign users to a vehicle.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Header Parameters

Request Body

application/json
  1. body
vehicleNumber*string

Registration or fleet number. Required and must not be used by another vehicle.

vehicleLabel?|

Optional friendly name. Also used to name the vehicle's van stock location.

vehicleType*string

Required. VAN, CAR, MOTORBIKE, FOOT (salesperson on foot) or OTHER.

Value in"VAN""CAR""MOTORBIKE""FOOT""OTHER"
status*string

ACTIVE (default), INACTIVE, ARCHIVED or DELETED. Users can only be assigned to ACTIVE vehicles.

Value in"ACTIVE""INACTIVE""ARCHIVED""DELETED"
lastOdometerKm?|

Optional odometer reading in kilometres; zero or more.

Formatint32
notes?|

Optional free-text notes.

Response Body

OK

*/*
  1. response
status*string

Outcome of the call: SUCCESS when the request was handled, ERROR otherwise.

message*string

Short human-readable message describing the outcome, e.g. which record was fetched or saved.

data?

The vehicle.

Example Request
curl -X POST 'https://beta.iotoms.com/api/v1/ops/vehicles' \  -H 'Content-Type: application/json' \  -d '{  "vehicleNumber": "string",  "vehicleType": "VAN",  "status": "ACTIVE"}'
Example Response
{  "status": "string",  "message": "string",  "data": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "vehicleNumber": "string",    "vehicleLabel": "string",    "vehicleType": "VAN",    "status": "ACTIVE",    "lastOdometerKm": 0,    "notes": "string",    "assignment": {      "property1": {        "assignmentId": "dbf5135c-beb7-4185-80db-2e980c77381b",        "userId": 0,        "username": "string",        "assignmentRole": "string",        "assignedAt": "2019-08-24T14:15:22Z",        "assignedBy": "string",        "isActive": true      },      "property2": {        "assignmentId": "dbf5135c-beb7-4185-80db-2e980c77381b",        "userId": 0,        "username": "string",        "assignmentRole": "string",        "assignedAt": "2019-08-24T14:15:22Z",        "assignedBy": "string",        "isActive": true      }    }  }}