LACMTA / metro-api-v2

Docs: https://lacmta.github.io/metro-api-v2/ Dev: https://dev-metro-api-v2.ofhq3vd1r7une.us-west-2.cs.amazonlightsail.com/docs
https://api.metro.net/docs
0 stars 3 forks source link

Update output for `/all/route_overview` #540

Closed matikin9 closed 3 months ago

matikin9 commented 3 months ago

https://api.metro.net/all/route_overview

Endpoint should return an array of 3 objects, representing these 3 service types in this order:

Routes will fall into one of these 3 categories based on the route_type field (ignore route_type = express).

[
    {
        ...rail data...
    },
    {
        ...busway data...
    },
    {
        ...bus data...
    }
]

Within the object for each service type, provide the route_type and an array of the routes. Later on we can include things like the service type's icon. The array of routes will be the objects currently being returned in the route_overview endpoint, but sorted by display_order.

Example for rail:

{
    "route_type": "rail",
    "routes": [
        { ...route... },
        { ...route... },
        { ...route... }
    ]
}

Example results:

[
    {
        "route_type": "rail",
        "routes": [
            { ...route... },
            { ...route... },
        ]
    },
    {
        "route_type": "busway",
        "routes": [
            { ...route... },
            { ...route... },
        ]
    },
    {
        "route_type": "bus",
        "routes": [
            { ...route... },
            { ...route... },
        ]
    },
]
albertkun commented 3 months ago

completed at https://api.metro.net/all/route_overview with pr #542

image

[
  {
    "route_type": "bus",
    "routes": [
      {
        "route_id": "2-13172",
        "route_code": "2",
        "route_code_padded": 2,
        "route_short_name": "2",
        "route_long_name": "Metro Local Line",
        "route_desc": "WESTWOOD - EXPOSITION PARK VIA SUNSET-ALVARADO",
        "route_type": "bus",
        "route_color": "E16710",
        "route_text_color": null,
        "route_url": null,
        "agency_id": "LACMTA",
        "line_id": 2,
        "alt_id": null,
        "long_name": null,
        "description": "USC - Westwood via Sunset Bl",
        "pdf_file_url": "https://cdn.beta.metro.net/wp-content/uploads/2022/10/17200812/002_TT_10-23-22.pdf",
        "pdf_file_link": "https://www.metro.net/line-override/22-10-line-002/attachment/002_tt_10-23-22/",
        "iconography_url": null,
        "terminal_1": "Westwood",
        "terminal_2": "USC",
        "arterials": "Sunset Bl",
        "description_0": "Westwood to USC",
        "description_1": "USC to Westwood",
        "display_order": 0,
        "travel_direction_0": "Eastbound",
        "travel_direction_1": "Westbound",
        "is_active": true
      },
      {
        "route_id": "4-13172",
        "route_code": "4",
        "route_code_padded": 4,
        "route_short_name": "4",
        "route_long_name": "Metro Local Line",
        "route_desc": "DOWNTOWN LA - SANTA MONICA VIA SANTA MONICA BL",
        "route_type": "bus",
        "route_color": "E16710",
        "route_text_color": null,
        "route_url": null,
        "agency_id": "LACMTA",
        "line_id": 4,
        "alt_id": null,
        "long_name": null,
        "description": "Downtown LA - Santa Monica via Santa Monica Bl",
        "pdf_file_url": "https://cdn.beta.metro.net/wp-content/uploads/2022/10/17201140/004_TT_10-23-22.pdf",
        "pdf_file_link": "https://www.metro.net/line-override/22-10-line-004/attachment/004_tt_10-23-22/",
        "iconography_url": null,
        "terminal_1": "Santa Monica",
        "terminal_2": "Downtown LA",
        "arterials": "Santa Monica Bl",
        "description_0": "Santa Monica to Downtown LA",
        "description_1": "Downtown LA to Santa Monica",
        "display_order": 1,
        "travel_direction_0": "Eastbound",
        "travel_direction_1": "Westbound",
        "is_active": true
      },