OpenAPI 1.2

부분 유료
분류별 TransLoc | 업데이트됨 לפני 16 ימים | Location
인기

9.9 / 10

지연 시간

107ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

Data Object is Empty

Rapid account: Cbreezy 517
cbreezy517
7 years ago

Hi,

I’m trying to get the arrival time for a stop on one of the buses for the University of Florida. I can’t find any documentation on what number the agencies are, what number the routes are, or what number the stops are. I found out from other support questions that the UF RTS service is agency 116. I am assuming that the route number I wanted to use was the same as what it is called here (122) and I found a stop number (1413) by a texting service by RTS.
Assuming all of these are correct, my data object is seen as “[]” when printed. There is no arrival time, vehicle, etc.

For testing, this is the GET I am using (minus my Mashape key) :

response = unirest.get(“https://transloc-api-1-2.p.mashape.com/arrival-estimates.json?agencies=116&callback=call&routes=122&stops=1413%2C1408”,
headers={“X-Mashape-Key”: “--------------------------------------------”,“Accept”: “application/json”})

If you can help me by giving me the agency, route, and stop numbers list (which is where I think I am going wrong), I would greatly appreciate it.

Rapid account: Transloc
transloc Commented 7 years ago

Hello,

First of all, thanks for writing in. It’s always great to hear who is using the API, and how.

Generally speaking, if you’re trying to discover a particular ID, we recommend querying the endpoint and parsing the response for the element in question. For example, if you’re looking for Route 122, I’d query the Routes endpoint with UFL’s agency ID without restrictions, and look for 122. That will return every route, it’s name, short name (this is the “122” number you’re looking for) and other information. This is the correct method for discovering agency_id, route_id, stop_id, etc.

In the example you provided, Route 122 has the route_id 4001178. Stop code 1413 corresponds to stop_id 4091950. If you use those in your query, you should get the response you’re looking for. The simplest explanation for why there isn’t a 1:1 map of the code you know to the correct ID is that our database is far more strict about naming conventions than transit agencies are.

If you’re developing an application that is powered by our API, the best practice is to retrieve all of the agency information up front, store it in a database, and reference a local store of the data. Endpoints like “arrival estimates” and “vehicles” will update constantly, but the others shouldn’t change more than a few times a year.

Let me know if you have any other questions!

Best,
Spenser @ TransLoc

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입