0

I am getting the permission error after calling the here api. https://route.cit.api.here.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&app_code=xx&app_id=xx

I used this for APP Id and API Key for app_code but not working. How to fix this?

enter image description here

{
    "_type": "ns2:RoutingServiceErrorType",
    "type": "PermissionError",
    "subtype": "InvalidCredentials",
    "details": "This is not a valid app_id and app_code pair. Please verify that the values are not swapped between the app_id and app_code and the values provisioned by HERE (either by your customer representative or via http://developer.here.com/myapps) were copied correctly into the request.",
    "metaInfo": {
        "timestamp": "2021-12-14T14:26:21Z",
        "mapVersion": "8.30.127.153",
        "moduleVersion": "7.2.202150-9770",
        "interfaceVersion": "2.6.77",
        "availableMapVersion": [
            "8.30.127.153"
        ]
    }
}
Shing Ho Tan
  • 931
  • 11
  • 30

1 Answers1

1

The app_code is not the same as the apiKey.

The app_id/app_code combination is a deprecated authentication method for the HERE location services, that's why you won't find the app_code that matches your app_id in the developer portal anymore.

Instead, try using apiKey only:

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&apiKey=[YOUR_API_KEY]

Notice that the base URL is slightly different when using apiKey.

astro.comma
  • 181
  • 9
  • Thank you for your answer and seems like it's working. But Can I get speed limit using this API? – Shing Ho Tan Dec 14 '21 at 18:11
  • @DevLover Yes, you can get speed limits with this API. If you add "sl" to your "linkattributes" parameter, you will get the Speed Limit for every road segment in your route. Like this: &linkattributes=nl,fc,sl. Please consider marking the response above as the correct one if this answers your question :) – astro.comma Dec 14 '21 at 18:26
  • Thank you for response. I am still checking but I cannot find any speed limit related thing in the response. I also added sl in the linkattributes. – Shing Ho Tan Dec 15 '21 at 01:38
  • You'll find the Speed Limit values in response.route[n].leg[n].link[n].speedLimit. Note that this endpoint returns Speed Limit values in m/s. – astro.comma Dec 15 '21 at 01:53
  • https://ibb.co/4jGX7t7 Please check this. This is the link object – Shing Ho Tan Dec 15 '21 at 02:02
  • 1
    @DevLover are you getting that from the request in your example? Seems like you're making a different call because the linkIds you're getting are not present in the response I'm getting. Your original request is definitely returning a speedLimit property in the link object. – astro.comma Dec 15 '21 at 02:10
  • https://route.ls.hereapi.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=41.889892,123.410005&waypoint1=42.889892,123.410005&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc,sl&mode=fastest;car;traffic:enabled&apiKey=XXXX This is my request. – Shing Ho Tan Dec 15 '21 at 02:12
  • 1
    @DevLover that's a different request, and it is in China. China is considered an Entry Map in HERE Maps; it's not suitable for the routing/navigation use case, and Speed Limits are not available. See https://developer.here.com/documentation/routing/dev_guide/topics/coverage-auto-routing.html – astro.comma Dec 15 '21 at 02:19
  • Ah I see, Thanks. – Shing Ho Tan Dec 15 '21 at 02:30