iotoms Docs

Assign a vehicle to a route plan

PUT
/api/v1/ops/route-plans/{templateId}/assign-vehicle

Pairs a vehicle with a route plan; send a null vehicleId to clear the pairing. The pairing is used when a salesperson starts their day on the mobile app.

How to use it

  1. Take the route plan ID from List route plans and an active vehicle ID from List vehicles.
  2. Send vehicleId to pair them, or null to clear the pairing; inactive vehicles are rejected.
  3. Users assigned to the vehicle get a Route assigned notification, and the pairing is used when they start their day.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

templateId*string

ID of the route plan, from List route plans.

Formatuuid

Header Parameters

Request Body

application/json
  1. body
vehicleId?|

Vehicle to pair with the route plan, from List vehicles. It must be active. Send null to clear the current pairing.

Formatuuid

Response Body

OK

*/*
  1. response
status*string

Outcome of the call: SUCCESS when it worked, ERROR when it failed.

message*string

Short human-readable message describing the outcome, for example "Vendor created". Do not parse it.

data?

The route plan with its ordered stores and any assigned vehicle.

Example Request
curl -X PUT 'https://beta.iotoms.com/api/v1/ops/route-plans/497f6eca-6276-4993-bfeb-53cbbbba6f08/assign-vehicle' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "status": "string",  "message": "string",  "data": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "planName": "string",    "planCode": "string",    "coverageTarget": 0,    "assignedVehicle": {      "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",      "vehicleNumber": "string",      "vehicleLabel": "string",      "vehicleType": "VAN"    },    "stores": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "storeId": "b8adcdc8-9238-4168-90f8-77b2d14c211c",        "customerStoreId": 0,        "storeCode": "string",        "storeName": "string",        "sequence": 0,        "geoLat": 0,        "geoLon": 0      }    ],    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}