OneBusAway / onebusaway-android

The official Android app for OneBusAway
http://www.onebusaway.org/
Other
484 stars 295 forks source link

Support new OTP trip planning URL format for Puget Sound #965

Open barbeau opened 5 years ago

barbeau commented 5 years ago

Summary:

Late last week Sound Transit rolled out a new OTP URL format that broke trip planning in OBA Android.

Here's the URL format that broke:

http://tpng.api.soundtransit.org/tripplanner/st/plan?date=03-01-2019&mode=TRANSIT,WALK&arriveBy=false&wheelchair=false&optimize=QUICK&showIntermediateStops=true&fromPlace=47.7163,-122.295&toPlace=47.7313,-122.315&time=02:25PM

They eventually rolled the change back yesterday to give us time to adapt.

Here's the email from Sound Transit:

Trip Planner has multiple endpoints - /tripplanner/st/plan, /tripplanner /st/planP, /tripplanner /st/v1/plan. Please use “/tripplanner/st/v1/plan” used by ST website for your tests and we roll out new features for this EP only.

Here are few updates that has to be done in your request:

  1. Use “/tripplanner/st/v1/plan” endpoint
  2. Date in YYYY-MM-DD format
  3. Time in 24 hours format
  4. MaxWalkDistance in meters

Your request would have been working fine before our last week release in which we have added “Travel Window validation” to filter out Itineraries whose Start Time(for Leave At Option) or End Time(for Arrive By Option) is outside of 4 hours compared to Request Time. Trip Planner responds back with 490 Error Code if all of the Itineraries are filtered out.

The modified request Urls:

Adding to my last email about API endpoints. OBA system can still use “/tripplanner/st/plan” which produces JSON response.

The “/tripplanner/st/v1/plan” EP produces response in XML and response format is the only difference.

Steps to reproduce:

Plan a trip with the Sound Transit OTP server-side changes in place

Expected behavior:

Plan a trip successfully

Observed behavior:

An empty trip plan is returned with no itineraries

Device and Android version:

N/A

barbeau commented 4 years ago

From further communication with Sound Transit, JSON output is possible (and the default?) from the v1 endpoint too. Here's a sample response from curl:

response.txt