I'm trying to access eg. https://mapapi.cloud.huawei.com/mapApi/v1/routeService/*
, but only getting 405/403
, while endpoints elevation
and mapService
are returning HTTP/1.1 200 OK
.
I'm using an API key from an AgConnect project, but also tried with one from HMS Developer site. And also tried providing a bearer token, which lead to the same result, while it works for other APIs.
POST {"origin":{"lat":54.216608, "lng":-4.66529},"destination":{"lat":54.2166, "lng":-4.66552}}
HTTP/1.1 405 Method Not Allowed {"returnCode": "403", "returnDesc": "REQUEST_DENIED"}
The documentation for return-code 403
reads:
The app ID does not have the service call permission.
Enable Map Kit in AppGallery Connect. For details, please refer to Enabling Services.
But Map Kit API is enabled and endpoints elevation
and mapService
do count towards the quota.
What's wrong with the routeService
endpoint? Or is this service only available in Mainland China? Just wondering, because I'm requesting from localhost
in Europe. Related code: Directions.php
. MapKitTest.php
needs an API key defined in phpunit.xml
to reproduce the problem.
<env name="HUAWEI_MAPKIT_API_KEY" value=""/>
When I try with another project with Map Kit disabled, the calls to Elevation, Static Map and Map Tile API fail. It's only the routeService
endpoint and these requests are nowhere being logged.
I got the same problem and solved it by activating Navi Kit in AppGallery Connect. Finally, don't forget to update your agconnect-services.json file