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 contains reserved characters as content, percent-encode them and leave delimiters unencoded. Don't double-encode. Unencoded reserved characters act as delimiters while encoded ones are treated 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
Did this page help you?