google-maps - Google Places API 上的分页返回状态 INVALID_REQUEST

标签 google-maps google-places-api rate-limiting

我正在使用 Google Place API 进行地点搜索:

https://developers.google.com/places/documentation/search

在api的第一次查询之后,我通过设置pagetoken来获取下一页。如果我在请求之间等待 2 秒,它会起作用,但我注意到如果我在上一个查询之后立即进行下一个查询,它会返回状态 INVALID_REQUEST。

这是某种速率限制吗?我在文档中的任何地方都没有看到这一点。

https://developers.google.com/places/usage

由于每个请求有 20 个位置,因此获取 100 个结果的列表将花费 10 秒以上,这对于使用应用程序的人来说是很长的时间。

最佳答案

它被记录在案,参见 documentation

By default, each Nearby Search or Text Search returns up to 20 establishment results per query; however, each search can return as many as 60 results, split across three pages. If your search will return more than 20, then the search response will include an additional value — next_page_token. Pass the value of the next_page_token to the pagetoken parameter of a new search to see the next set of results. If the next_page_token is null, or is not returned, then there are no further results. There is a short delay between when a next_page_token is issued, and when it will become valid. Requesting the next page before it is available will return an INVALID_REQUEST response. Retrying the request with the same next_page_token will return the next page of results.

关于google-maps - Google Places API 上的分页返回状态 INVALID_REQUEST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21265756/

相关文章:

javascript - 谷歌地图 - 奇怪的 geometry.location 属性(G,K)

rest - 匿名访问 REST API?

node.js - express-rate-limit 阻止所有用户的请求

c# - 如何在 ASP.NET MVC 站点中实现速率限制?

google-maps - 谷歌地图搜索位置

google-maps - 谷歌地图 KML : 8-Digit Hex Code

javascript - 如何从 Google map 对象中隐藏公交车?

java - Android谷歌地图标记不断点击同一点

java - 如何在 Android 中将自动完成搜索与谷歌地图集成?

android - 我使用的每个 API 都需要一个 API key 吗?