尝试获取自动完成建议时收到 ERR_CONNECTION_REFUSED

Receiving ERR_CONNECTION_REFUSED when trying to fetch autocomplete suggestions

我在 here-api 注册了一个帐户,今天刚创建了一个新的 apiKey,因为我们仍在使用旧的身份验证方法。 不管我们使用什么身份验证,我们在尝试访问 suggestion.json 端点时都会收到 ERR_CONNECTION_REFUSED 错误。其他端点工作正常。 IE。此请求工作正常:

https://geocoder.ls.hereapi.com/6.2/geocode.json?searchtext=200%20S%20Mathilda%20Sunnyvale%20CA&gen=9&apiKey={API_KEY}

但这失败了:

http://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?query=Pariser+1+Berl&beginHighlight=<b>&endHighlight=</b>&apiKey={API_KEY}

显然使用相同的 API 键,但出现上述 ERR_CONNECTION_REFUSED 错误。

同样让我感到困惑的是,从第一个请求中的 api 键中删除一个字符会导致有意义的响应

{
  "error": "Unauthorized",
  "error_description": "ApiKey invalid. ApiKey not found."
}

而在第二个请求中这样做仍然只是 returns ERR_CONNECTION_REFUSED 错误。

能否请您尝试在您的请求中使用 https instead of http 作为 -

https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?query=Pariser+1+Berl&beginHighlight=<b>&apiKey=apikey

作为 Javascript 的示例,也在使用 https,并且可以正常工作。

https://developer.here.com/documentation/examples/rest/geocoding_suggestions