here-apitransit

Different responses for station search with name in Here API V3 and V8


Using HERE Public Transit API V3 for searching stations with name and radius, I get up to 25 stations with the following query:

https://transit.ls.hereapi.com/v3/stations/by_name.json?
center=50.7374,7.0982&name=berlin&max=25&radius=90000000&apiKey={YOUR_API_KEY}

Converting the same query to HERE Public Transit API V8(next line) does not deliver any stations.

https://transit.hereapi.com/v8/stations?
in=50.7374,7.0982&name=berlin&r=90000000&maxPlaces=25&apiKey={YOUR_API_KEY}

In the migration document, there is no information regarding this matter. It is only mentioned that some of the results' parameters are removed but not the results themselves.


Solution

  • The problem is due to incorrect usage of radius in your Public Transit v8 API call. In your V8 query you have provided radius(r) as a separate parameter which is incorrect.

    Please note the correct way to provide radius information in V8 is parameter in= {lat},{lng}[;r={radius}], where radius=500 meters by default.

    You can also see the documentation in https://developer.here.com/documentation/public-transit/migration_guide/topics/stations-migration.html

    Providing radius the right way(below query) fetches the required results.

    https://transit.hereapi.com/v8/stations?in=50.7374,7.0982;r=90000&name=berlin&maxPlaces=25&apiKey={YOUR_API_KEY}