Locations

Retrieve a list of locations for a given vehicle

Retrieves a list of locations. The {id} parameter corresponds to the vehicle id, not to be confused with the vehicle's unit id.

get/v2/vehicles/{id}/locations

Request

  • Base URL: https://api.onswitchboard.com
  • URL: https://api.onswitchboard.com/v2/vehicles/{id}/locations
  • Auth: API key in header x-api-id and API key in header x-api-key

Query parameters

limitstring

Maximum number of results to return per request (1-250). Defaults to 100 when omitted. Values above the maximum are capped, not rejected.

pagestring

Deprecated. Use cursorId instead. Offset-based page number (0 or greater); page * limit must not exceed 500.

cursorIdstring

Location objectId from meta.nextCursor of the previous response. Returns the next page of locations older than this id (exclusive), using default dateTime descending sort.

startmillisstring

The starting epoch timestamp in milliseconds (inclusive). When neither startmillis nor endmillis is supplied, results default to the last 1 hour. Passing startmillis=0 disables the lower bound and scans the full history.

endmillisstring

The ending epoch timestamp in milliseconds (inclusive). Supplying endmillis on its own suppresses the 1 hour default lower bound.

Response

Successully performed operation

Example response

{
  "meta": {
    "totalCount": 10,
    "limit": 10,
    "hasMore": true,
    "nextCursor": "yklTrCPAC1",
    "previousCursor": "yklTrCPAC1",
    "warning": "The \"cursor\" query parameter is deprecated; use \"cursorId\" instead."
  },
  "company": {
    "name": "Example Company"
  },
  "trip": {
    "estimatedDistanceKm": 595.949,
    "startLocation": {
      "latitude": 49.123,
      "longitude": -123.123,
      "dateTime": "2020-01-01T00:00:00.000Z"
    },
    "endLocation": {
      "latitude": 49.123,
      "longitude": -123.123,
      "dateTime": "2020-01-01T00:00:00.000Z"
    }
  },
  "locations": [
    {
      "objectId": "2ntvSpRGIK",
      "id": "2ntvSpRGIK",
      "city": "Vancouver",
      "country": "CA",
      "stateProvince": "BC",
      "longitude": -123.123,
      "latitude": 49.123,
      "dateTime": "2020-01-01T00:00:00.000Z",
      "drivers": [
        {
          "id": "2ntvSpRGIK"
        }
      ],
      "odometerReadingKm": 160424.12,
      "engineHours": 1204.1,
      "speedKm": 84,
      "vehicleSerial": "563062023431345",
      "vehicleVIN": "JTLKE50E581048963",
      "vehicleUnitId": "TRUCK001"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.