net-art-uchicago / cta-file-sharing

a collaborative artware project by Media Art and Design students at the University of Chicago.
GNU General Public License v3.0
2 stars 15 forks source link

Bus Tracking #4

Open bensim0305 opened 1 year ago

bensim0305 commented 1 year ago

Get bus route from CTA Bus Tracker API, take the user input of what bus they are on and then send a get request to the CTA Bus Tracker API to get the bus route

GET:

1. get CTA routes

endpoint URL: /api/cta-routes description: return an array of CTA route numbers

request optional URL parameters

param description example
loc GPS coordinates 41.78868316205326, -87.59874232864101

an example of a request with specifc params set might be:

/api/cta-routes?loc=121.121029,23.1029381208

the request above will return an array of route numbers close to the specified location

response returns an Array of CTA route numbers, example

 [
  172,
  132,
  45
]

2. near a stop

endpoint URL: /api/cta-near-stop description: return an array of stops

request REQUIRED parameters

param description example
loc GPS coordinates 41.78868316205326, -87.59874232864101

for example:

/api/cta-near-stop?loc=1.78868316205326,-87.59874232864101

3. distance from bus

endpoint URL: /api/cta-bus-distance description: return an a bus object (which includes, distance from the user and other bus info)

request REQUIRED parameters

param description example
loc GPS coordinates 41.78868316205326, -87.59874232864101
route the bus route number 172

for example

/api/cta-near-stop?route=172&loc=1.78868316205326,-87.59874232864101
akhaiat2 commented 1 year ago

Going to be joining this too...

bensim0305 commented 1 year ago

bus API also gets route data like route lists, stops, route definitions, etc. Also note theres a cap of 10,000 requests a day