【问题标题】:Receiving ERR_CONNECTION_REFUSED when trying to fetch autocomplete suggestions尝试获取自动完成建议时收到 ERR_CONNECTION_REFUSED
【发布时间】:2020-01-13 15:47:38
【问题描述】:

我在 here-api 上注册了一个帐户,今天刚刚创建了一个新的 apiKey,因为我们仍然使用旧的身份验证方法。 不管我们使用什么身份验证,在尝试访问suggestion.json-endpoint 时都会收到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 错误。

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

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

而在第二个请求中执行此操作仍然只会返回 ERR_CONNECTION_REFUSED 错误。

【问题讨论】:

    标签: here-api here-maps-rest


    【解决方案1】:

    您能否尝试在您的请求中使用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

    【讨论】:

      猜你喜欢
      • 2015-04-06
      • 1970-01-01
      • 1970-01-01
      • 2012-07-07
      • 1970-01-01
      • 2011-06-08
      • 1970-01-01
      • 2014-10-12
      • 2012-07-31
      相关资源
      最近更新 更多