错误的错误消息 - 这里地理编码 API - InvalidCredentials

Wrong Error Message - Here Geocode API - InvalidCredentials

我有一个需要转换为坐标的地址列表,这里 Geocode API 停在列表中间,returned "InvalidCredentials"/"PermissionError" 这是错误的,因为我的凭证是有效的。

下面是完整的错误消息:

<ns2:Error xmlns:ns2="http://www.navteq.com/lbsp/Errors/1" type="PermissionError" subtype="InvalidCredentials"><Details>invalid credentials for </Details></ns2:Error>

然后我检查了我的请求,我发现问题与凭据无关,而是地址文本中的“#”。

错误消息是错误的,如果 Here 可以专门针对这种情况更改消息,那将非常有帮助。

通过在地址字符串中包含“#”可以重复:

例如:https://geocoder.api.here.com/6.2/geocode.json?searchtext=1920+River+Rd+Apt#57,+Tucson,+AZ&app_id=:your_app_id&app_code=:your_app_code&gen=9

它将 return 200 如果您在请求中删除“#”则成功。另请注意,您可能需要将您的应用程序 ID 和应用程序代码放在上面的 url 中。

希望这个 post 可以帮助其他遇到同样问题的人,这里 API 开发人员可以看到这个,也许可以更改它的 return 消息。

“#”需要编码为 %23。参见 URL Encoding