MTD Developer Forum
»
API
»
General Discussion
»
Empty departures arrays are omitted
Rank: Advanced Member
Groups: Registered
Joined: 7/10/2011(UTC) Posts: 34
Thanks: 1 times
|
I noticed this evening that my app is throwing an error whenever it calls GetDeparturesByStop for a stop with no buses coming. The API (versions 2.0 and 2.1) reports Code:{
"time": "2012-06-16T21:40:44-05:00",
"new_changeset": true,
"status": {
"code": 200,
"msg": "ok"
},
"rqst": {
"method": "GetDeparturesByStop",
"params": {
"pt": 60,
"stop_id": "APTHICRS"
}
}
}
which causes an error in my app, since it expected a "departures" array, even if an empty one. This request goes fine when there are buses coming. Edited by user Saturday, June 16, 2012 8:43:52 PM(UTC)
| Reason: fix
|
|
|
|
Rank: Administration
Groups: Administrators, Registered Joined: 6/1/2011(UTC) Posts: 88 Location: Urbana Thanks: 1 times Was thanked: 6 time(s) in 6 post(s)
|
Sorry about that. The issue should be fixed now. By the way, if there are no buses coming it will indeed return an empty array and a 200 status code, but if you request a stop that doesn't exist it will return a 404 as the status code and "Stop not found" as the message. Hopefully this will allow developers to display the appropriate message to their users.
|
1 user thanked Ryan for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 7/10/2011(UTC) Posts: 34
Thanks: 1 times
|
Yes, it is working now. Thanks!
|
|
|
|
MTD Developer Forum
»
API
»
General Discussion
»
Empty departures arrays are omitted
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.