【问题标题】:Google placed API : search restaurent by country or restaurent nameGoogle Places API:按国家或餐厅名称搜索餐厅
【发布时间】:2016-05-19 12:47:52
【问题描述】:

我正在尝试根据国家名称和餐厅名称从阿联酋获取所有餐厅,例如肯德基,如下所述

 var url https://maps.googleapis.com/maps/api/place/textsearch/xml?name=KFC&key=[my_key]&country=KSA&type=restaurant

这是我得到的回应

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<PlaceSearchResponse>
<status>INVALID_REQUEST</status>
</PlaceSearchResponse>

我如何获取特定国家/地区的餐厅列表,例如阿联酋需要您的帮助

【问题讨论】:

    标签: javascript google-maps google-places-api


    【解决方案1】:

    Places API Web Service 中的INVALID_REQUEST 一般表示请求包含缺少参数。尝试添加名称超过 255 个字符的地点时也会返回。只需仔细检查您的 HTTP URL 请求即可。

    这是一个文本搜索 HTTP URL 请求示例:

    https://maps.googleapis.com/maps/api/place/textsearch/output?parameters
    

    输出可以是 JSON 或 XML,所需的参数是 querykey * query 是要搜索的字符串,例如:“restaurant” * key 是你的应用程序API key

    以下示例显示了搜索悉尼附近的餐厅:

    https://maps.googleapis.com/maps/api/place/textsearch/xml?query=restaurants+in+Sydney&key=YOUR_API_KEY
    

    【讨论】:

      猜你喜欢
      • 2013-04-08
      • 1970-01-01
      • 2019-08-14
      • 1970-01-01
      • 2011-09-21
      • 1970-01-01
      • 2013-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多