trip_id changes over time, best practice for game to fetch a valid trip_id?

118 görüntüleme
İlk okunmamış mesaja atla

Nelson Correia

okunmadı,
1 Nis 2021 10:02:341.04.2021
alıcı MBTA Developers
Hello Everyone, thank you for permitting me to join the group.

I am currently working on a personal project to help my son learn how to read analog clocks. He loves riding the Red Line and so I am using the API to build a game as way to make the learning process fun for him.

After taking some time off from the project, I learned that the request string was no longer valid. My understanding, at this point, is that the trip_ids expire over time.

Is there a best practice to fetch a valid trip_id automatically, so that the game can run without scheduled adjustments? Thank you.

Developer at MBTA

okunmadı,
6 Nis 2021 15:30:276.04.2021
alıcı MBTA Developers
Hi,

You're correct that trip IDs are not stable over time, since of course the scheduled service on a line changes over time, which necessitates adding or removing trips.

If you just want to fetch any single valid trip on the Red Line, you can use the `route` filter on the `/trips` endpoint (e.g. /trips?filter[route]=Red&page[limit]=1). Similarly, you can filter the `/schedules` and `/predictions` endpoints by route if you'd like to directly get a stop time for the game without going through trips.

Route IDs are stable over time unless the route itself is eliminated — unlikely, in the case of the Red Line, but if you wanted to avoid hard-coding any specific ID you could request `/routes` and pick one (this endpoint has no required filters).

Hope this helps,
—Developer@MBTA

Nelson Correia

okunmadı,
7 Nis 2021 11:45:137.04.2021
alıcı MBTA Developers
Hello Developer @ MBTA,

Thank you so much for the response. This is great! It takes much of the guess work out.

On a side note, there's another conversation that I would like to vote up:


Adding announcements to the game would definitely level up the fun factor.

Michael G

okunmadı,
9 Nis 2021 10:10:339.04.2021
alıcı MBTA Developers

Thank you for supporting my post! Hopefully we will get them soon. 

Nelson Correia

okunmadı,
9 May 2023 00:38:079.05.2023
alıcı MBTA Developers
Hi Developer@MBTA,

It works! So after a number of life changes and a concentrated effort in activating the basic functionality of this game, I can say the majority of remaining concerns are centered around UI/UX.

I used a combination of routePattern and filter[date] to generate the starting data and, then, refined it through the schedule endpoint to get stop data to build out the game elements.

Here's a link to the game:

Here's a demo video:

MBTA Rush v1.0.0

Anthony Blake

okunmadı,
21 May 2023 18:33:1621.05.2023
alıcı MBTA Developers
how do u fetch the data usindatapng.png
Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti