此处 Fleet Telematics CalculateRoute 服务无法使用 api 键访问
Here Fleet Telematics CalculateRoute service not accessible using api key
我正在尝试使用 Here Fleet Telematics CalculateRoute.json 服务来计算行程费用(通行费等)。示例页面使用 api_id 和 api_key 进行身份验证。在我的(免费增值)帐户中,我看不到可以生成它的方法。
我所做的是复制示例站点发出的请求,并将 app_id 和 app_key 参数替换为 apikey=**key**
。我还删除了 jsoncallback 参数。
我得到了以下 JSON:
的支持
{
"faultCode": "s14e781b4-b577-4b58-86bb-359ee5c8a979",
"responseCode": "400",
"message": "The request is missing the app_id and app_code parameters. They must both be passed as query parameters. If you do not have app_id and app_code, please obtain them through your customer representative or at http://developer.here.com/myapps."
}
更新:
我希望实现的是使用 POST http 方法。根据 https://developer.here.com/documentation/fleet-telematics/api-reference.html 部分 "Calculates a route with additional fleet telematics features",这应该是可能的。
确切的请求消息是(没有实际的 api 密钥):
POST https://fleet.ls.hereapi.com/2/calculateroute.json
Content-Type: application/json
{
"apiKey": "**SNIP**",
"waypoint0": "38.72639,-9.14949",
"waypoint1": "47.54881,7.58782",
"detail": "1",
"maneuverAttributes": "none",
"linkAttributes": "none,sh",
"legAttributes": "none,li",
"currency": "EUR",
"departure": "",
"tollVehicleType": "3",
"trailerType": "2",
"trailersCount": "1",
"vehicleNumberAxles": "3",
"trailerNumberAxles": "2",
"hybrid": "0",
"emissionType": "5",
"fuelType": "diesel",
"height": "4m",
"trailerHeight": "400",
"vehicleWeight": "12000",
"limitedWeight": "40t",
"disabledEquipped": "0",
"minimalPollution": "0",
"hov": "0",
"passengersCount": "1",
"tiresCount": "14",
"commercial": "1",
"heightAbove1stAxle": "1m",
"width": "2.55",
"length": "16.5",
"mode": "fastest;truck;traffic:disabled",
"rollups": "none,country;tollsys",
"alternatives": "1"
}
这个 returns 以下:
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Date: Mon, 01 Jun 2020 11:10:09 GMT
Server: nginx-clojure
Content-Length: 74
Connection: Close
{
"error": "Unauthorized",
"error_description": "Token or apiKey is missing."
}
而在 GET 请求中传递所有与 url 参数相同的值是可行的。
您需要使用以下端点:
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey={YOUR_API_KEY}&...
请参阅 Send a Request and Calculate Toll Cost 文档页面。
我正在尝试使用 Here Fleet Telematics CalculateRoute.json 服务来计算行程费用(通行费等)。示例页面使用 api_id 和 api_key 进行身份验证。在我的(免费增值)帐户中,我看不到可以生成它的方法。
我所做的是复制示例站点发出的请求,并将 app_id 和 app_key 参数替换为 apikey=**key**
。我还删除了 jsoncallback 参数。
我得到了以下 JSON:
{
"faultCode": "s14e781b4-b577-4b58-86bb-359ee5c8a979",
"responseCode": "400",
"message": "The request is missing the app_id and app_code parameters. They must both be passed as query parameters. If you do not have app_id and app_code, please obtain them through your customer representative or at http://developer.here.com/myapps."
}
更新: 我希望实现的是使用 POST http 方法。根据 https://developer.here.com/documentation/fleet-telematics/api-reference.html 部分 "Calculates a route with additional fleet telematics features",这应该是可能的。
确切的请求消息是(没有实际的 api 密钥):
POST https://fleet.ls.hereapi.com/2/calculateroute.json
Content-Type: application/json
{
"apiKey": "**SNIP**",
"waypoint0": "38.72639,-9.14949",
"waypoint1": "47.54881,7.58782",
"detail": "1",
"maneuverAttributes": "none",
"linkAttributes": "none,sh",
"legAttributes": "none,li",
"currency": "EUR",
"departure": "",
"tollVehicleType": "3",
"trailerType": "2",
"trailersCount": "1",
"vehicleNumberAxles": "3",
"trailerNumberAxles": "2",
"hybrid": "0",
"emissionType": "5",
"fuelType": "diesel",
"height": "4m",
"trailerHeight": "400",
"vehicleWeight": "12000",
"limitedWeight": "40t",
"disabledEquipped": "0",
"minimalPollution": "0",
"hov": "0",
"passengersCount": "1",
"tiresCount": "14",
"commercial": "1",
"heightAbove1stAxle": "1m",
"width": "2.55",
"length": "16.5",
"mode": "fastest;truck;traffic:disabled",
"rollups": "none,country;tollsys",
"alternatives": "1"
}
这个 returns 以下:
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Date: Mon, 01 Jun 2020 11:10:09 GMT
Server: nginx-clojure
Content-Length: 74
Connection: Close
{
"error": "Unauthorized",
"error_description": "Token or apiKey is missing."
}
而在 GET 请求中传递所有与 url 参数相同的值是可行的。
您需要使用以下端点:
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey={YOUR_API_KEY}&...
请参阅 Send a Request and Calculate Toll Cost 文档页面。