Skip to content
carabalb edited this page Sep 14, 2022 · 26 revisions

This API returns the last known information of a bus, combining the TCIP-JSON real-time data directly from vehicles and corresponding inferred data. Information is only updated here when there is a valid position. Certain arguments to this API depend on post-inference values, as described below. If any of those arguments are used, only data that has both raw/real-time and corresponding inferred records will be returned.

Table of Contents

Call (multiple vehicles)

(ops component URL)/api/record/last-known/list

Options

URL Parameter Example Description
depot-id YU 2-letter depot code
inferred-route-id MTA NYCT_S74 Agency-qualified route id
inferred-phase IN_PROGRESS OneBusAway Phase
bbox 74.16376,-74.16585,40.57280,40.574445 bounding box in lat/lon (min_lon, min_lat, max_lon, max_lat). any bus whose lat/lon *or* inferred_lat_lon fall w/in that bbox should be returned.
example with options (ops component URL)/api/record/last-known/list?depot-id=<depot-id>&bbox=<min lon, min lat, max lon, max lat>

Call (single vehicles)

(ops component URL)/api/record/last-known/vehicle/<vehicle_id>

Response

Returns JSON data similar to:

 {
 "records": [
     {
       "uuid": "8b99f5e0-0813-11e2-901e-1231391c6b0a",
       "vehicle-agency-id": 2008,
       "time-reported": "2012-09-26T19:50:22.646Z",
       "time-received": "2012-09-26T19:51:21.406Z",
       "archive-time-received": "2012-09-26T19:51:21.392Z",
       "operator-id-designator": "000000",
       "route-id-designator": "000",
       "run-id-designator": "000",
       "dest-sign-code": 0,
       "latitude": 40.854316,
       "longitude": -74.341386,
       "speed": 0.0,
       "direction-deg": 0.00,
       "agency-id": "MTA NYCT",
       "vehicle-id": 234,
       "depot-id": "JG",
       "service-date": "1970-01-01",
       "inferred-latitude": 40.854317,
       "inferred-longitude": -74.341385,
       "inferred-phase": "DEADHEAD_BEFORE",
       "inferred-status": "default",
       "inference-is-formal": false
     },
     {...}
     ],
 "status":"OK"
 }
Clone this wiki locally