Realtime API Examples

Miscellaneous Examples

Here is a list of commands that you might use to build an application. This should give you a good idea of how the interface has been designed.

Command Description
Get all routes for LAMETRO (JSON)
Get all the stops for route 704 (JSON)
Get all the stops for route 704 (XML) lametro/routes/704/stops/callback=doList
Get all the stops for route 704 (JSON-P with callback “doList”) lametro/stops/6033/predictions/
Get the current arrival predictions for stop 6033 (JSON) lametro/stops/6033/messages/
Get messages for stop 6033 (JSON)
Get stop and sequence information for route 704 (XML) lametro/routes/704/sequence/
Get all the stops for route 704 in sequence (good for drawing route maps)
Get the runs for route 704 (XML)
Get all the Metro vehicles now running on route 704

3 thoughts on “Realtime API Examples

  1. Hi,
    I have a couple of questions/comments.

    1. I am trying to organize stop predictions for specific route+direction combinations. is returning an item with e.g. {“run_id”: “4_157_1″, “route_id”: “4”}. However, when I subsequently call to learn more about run 4_157_1, I only receive {“items”: [{“route_id”: “4_159_1″, “display_name”: “West to Santa Monica”, “id”: “4_159_1″, “display_in_ui”: true, “direction_name”: “West”}, {“route_id”: “4_165_0″, “display_name”: “East to Downtown LA – Broadway-Venice”, “id”: “4_165_0″, “display_in_ui”: true, “direction_name”: “East”}]}. Why doesn’t run 4_157_1 appear in this list?

    2. returns as an item, e.g. {“route_id”: “4_159_1″, “id”: “4_159_1″, ..}. Shouldn’t “route_id” be “4”, not “4_159_1″?

    3. Are run_id’s meant to map to trips in the GTFS data feed? They don’t seem to have matching IDs.

    4. The XML version appears to be returning 500 Server Errors. E.g. . This has been occurring for at least two weeks now.

    Thanks for your assistance!

    • Hi Jasonshah,

      These are good questions. I can confirm the problem you are seeing on questions 1 & 2. I’ll need to check with the Nextrip developers to give you a good answer.

      3. You should be able to find those run_ids in the GTFS. Are you looking at the most recent data?

      4. There is little demand for the XML feed and it has languished since I upgraded the server. Do you require it for your application?

      I will also look into giving more meaningful errors too. 50x errors aren’t very helpful!


Leave a Reply