I'm using Mapquest directions API and my goal is to create a route between a bunch of map points (3 and more).
Here is the API spec for "to" parameter of the endpoint that's used to fetch a route for a given set of points (it corresponds to the destination):
When the input format is key/value pairs, the ending location(s) of a Route Request. More than one to parameter may be supplied. This is used for single-line addresses only.
Refer to the Locations documentation on how to properly form locations in all formats, including JSON and XML.
AFAIK it means that multiple "to" parameters can be specified for a query, e.g. "http://www.mapquestapi.com/directions/v2/route?from=40.65,73.95&to=40.87,-73.85&to=40.70,-73.56 . Am I right about this?
So assuming that I understood the spec right, I need to construct an appropriate URI instance that will be dispatched to the http's library get method. The problem is that it receives a Map<String, String of query parameters in the constructor, and map means uniqueness. How can I construct such a request using URI class?
I've tried to make a workaround by just retrieving a string representation of an URI instance without specifying the to key-value pair and just writing the concatenated to-s in the end of the string with subsequent passing to the http.get. What I missed is that URI takes care for characters' escaping, and writing such a thing by myself seems to be completely inappropriate when the SDK already provides me with URI class.