iotoms Docs

Check readiness to start a session

POST
/api/v1/ops/sessions/preflight

Checks whether the signed-in user can start a session such as a van sales day or a POS shift, and returns any blocking issues, for example a missing route plan, vehicle or register, or a day already open.

How to use it

  1. Send sessionType and businessDate, plus registerId for a POS_SHIFT, or storeId/venueId for an ECOM_BATCH.
  2. For a DAY_CYCLE, send routePlanId and vehicleId, or omit them to use the user's assigned vehicle and its paired route plan.
  3. If blockingIssues is empty, start the session (for a van sales day, Start a day cycle). Nothing is changed by this check.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Header Parameters

Request Body

application/json
  1. body
sessionType*string

Session to check: DAY_CYCLE (van sales day), POS_SHIFT (till shift), ECOM_BATCH (online order batch) or OTHER_APP. Required.

Value in"DAY_CYCLE""POS_SHIFT""ECOM_BATCH""OTHER_APP"
businessDate*string

Business date the session would start on (YYYY-MM-DD). Required.

Formatdate
registerId?|

Register to use; required for POS_SHIFT. From List registers.

Formatint64
storeId?|

Store for an ECOM_BATCH; storeId or venueId is required for that type. From List stores.

Formatint64
venueId?|

Venue for an ECOM_BATCH; storeId or venueId is required for that type. From List venues.

Formatint64
routePlanId?|

Route plan for a DAY_CYCLE. Optional if the user's vehicle is paired with a route plan.

Formatuuid
vehicleId?|

Vehicle for a DAY_CYCLE. Optional if a vehicle is assigned to the user.

Formatuuid
deviceId?|

Optional identifier of the device making the check.

clientApp?|

Optional name of the calling app.

clientVersion?|

Optional version of the calling app.

lastSyncAt?|

When the device last synced data (ISO 8601 date-time). Omit to be told which feeds to sync.

Formatdate-time

Response Body

OK

*/*
  1. response
status*string

Outcome of the request: SUCCESS when it worked; errors return an error status with the reason in message.

message*string

Short human-readable message describing the outcome.

data?

The readiness check result, including any blocking issues.

Example Request
curl -X POST 'https://beta.iotoms.com/api/v1/ops/sessions/preflight' \  -H 'Content-Type: application/json' \  -d '{  "sessionType": "DAY_CYCLE",  "businessDate": "2019-08-24"}'
Example Response
{  "status": "string",  "message": "string",  "data": {    "sessionType": "DAY_CYCLE",    "businessDate": "2019-08-24",    "expectedOpeningCash": 0,    "currencyCode": "string",    "assignedVehicle": {      "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",      "vehicleNumber": "string",      "vehicleLabel": "string",      "vehicleType": "VAN",      "status": "ACTIVE",      "lastOdometerKm": 0    },    "routePlan": {      "routePlanId": "b7d64f28-bbfd-4033-80f5-b73a04c2781d",      "planName": "string",      "totalStores": 0,      "coverageTarget": 0    },    "inventoryPreview": {      "sessionId": "f6567dd8-e069-418e-8893-7d22fcf12459",      "totalSkuCount": 0,      "totalValue": 0,      "highValueItems": [        {          "itemId": "string",          "itemName": "string",          "quantity": 0,          "value": 0        }      ]    },    "lastSessionSummary": {      "lastBusinessDate": "2019-08-24",      "status": "string",      "cashVariance": 0,      "inventoryVariance": 0    },    "requiredChecks": [      "GPS_ENABLED"    ],    "blockingIssues": [      {        "code": "string",        "message": "string"      }    ],    "syncNeeds": [      {        "feed": "string",        "reason": "string",        "lastUpdatedAt": "2019-08-24T14:15:22Z"      }    ]  }}