URL encoding in HERE Routing API v8
Some parameters, especially waypoint specifications, can take a structured string as their value.
When that's the case, content characters can clash with control characters.
Take the following request as an example:
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=54.32556,14.65314&'\
'destination=54.65422,14.66636;nameHint=Fish Chips! St. 25&'\
'apiKey=YOUR_API_KEY'This request contains a reserved character ! and spaces in the value of nameHint.
These characters must be URL-encoded (percent-encoded) for disambiguation.
- Never encode
&or=when they are used as reserved characters. - If the request doesn't contain reserved characters as content (they are only used for their intended control meaning), you don't need to encode anything.
- If the request uses reserved characters as content, encode them, but leave the controlling characters unencoded. Don't double-encode. In such mixed requests, all naked reserved characters are be interpreted as control, and all encoded ones as content.
Taking these rules into consideration, this is the example request with the correct percent encoding applied:
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=53.32556,14.65314&'\
'destination=53.65422,14.66636;nameHint=Fish%20%26%20Chips%21%20St.%2025&'\
'apiKey=YOUR_API_KEY'Updated last month