谷歌放置API:按国家或餐馆名称搜索餐馆

Google placed API : search restaurent by country or restaurent name

本文关键字:餐馆 搜索 国家 API 谷歌      更新时间:2023-09-26

我正试图从阿联酋获得所有像肯德基这样的餐厅,而不是以下提到的国家名称和餐厅名称

 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>

我如何获得阿联酋等特定国家的餐厅列表需要您的帮助,请

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关键

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

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