[HELP] Dispaly info from bus stop API

Hey All,

Im learning about API’s and wanted to start with a simple project of just displaying transit information from the bus stop near me onto my tidbyt. I can’t seem to get it to work though, and was wondering if anyone here would know what im doing wrong?

Github Link of what I have made.

My States Local Transit site default outputs the information in XML , but if you add the tag ?format=json at the end it outputs the webpage in .json format.

I was thinking i could just plug that in like some of the examples of people have posted with API calls, but that doesnt seem to want to work…

Thanks in advance for any help Im having lots of fun learning!

TransSee supports LA Metro predictions. I am currently beta testing. Let me know at [email protected] if you want to try my system.

Hey Man,

If you’re able to make an Tidbyt app with all that info in it please share to the code so others can learn too! That’s what this community is all about!

I really just want to know how to get info from the Metro Transit site to display on my tidbyt!

I’ll take a proper look tomorrow, but the first thing I’d try doing is running the request with something like Postman.

If it all looks good there, I’d modify your code to see what the response code is for the ‘http.get’.

Then I’d try adding a print statement to see what the response is, and if it’s a 200, print the JSON body and see what it outputs.

I can write up some examples tomorrow.

My Steam app (https://github.com/jer-tav/tidbyt_apps/blob/main/steam/steam.star) has examples of most of this - happy to answer any questions about it.

Thanks @jeremy Ill poke around your steam app when i got some free time tomorrow!

I understand the basic premise of what i need to do is:

  1. Make a call to the API with the URL

  2. Website responds with my request in the form of either XML or JSON

  3. Pass that through Starlark in the form of a list or dictionary

  4. Use the headers to specify which of the actual fields i want to display on my Tidbyt.

As always easier said then done so I was just starting with display a really basic request from the API which only displays the directions a bus is going. IF i get that figured out i can branch into the more detailed calls!