What does block_C47-255_schedBasedVehicle mean in the vehicle id field?

Skip to first unread message

Rene Adaimi

Mar 3, 2022, 2:54:40 PMMar 3
to MBTA Developers

Sometimes when I query predictions I get back that the vehicle id is "block_C47-255_schedBasedVehicle", instead of a vehicle number like "y1234". This id can't be queried on the /vehicles api as well.

Sample query (today at 14:50): https://api-v3.mbta.com/predictions?filter[route]=47&filter[stop]=11803&filter[trip]=50263049

Sample response:

Any help is appreciated.
Thank you,

Developer at MBTA

Mar 10, 2022, 2:13:24 PMMar 10
to MBTA Developers
Hi, thanks for bringing this issue to our attention. These "non-existent" vehicles should not be appearing in the data, and these are actually predictions with no vehicle attached. You can see this more clearly if you add include=vehicle to your query — the lookup of the vehicle fails and the relationship is set to null. We will be working to fix this.

Some general reminders for using the API:
  • IDs returned in an API response are not guaranteed to be valid in a later request: your code needs to handle the possibility of the data not existing anymore. For example, the vehicle referenced by a prediction could have stopped tracking (and thus disappeared from the data) between the time you requested the predictions and the time you look up the vehicle. Where possible, we recommend using the include parameter to get all the data you need in a single response, at a single moment in time.
  • All IDs should be considered opaque: you should not rely on being able to extract any information from an ID. For example, if you need the rider-visible "number" of a bus, use the label attribute of the Vehicle resource.
Reply all
Reply to author
0 new messages