HERE Places API获取住宿结果仅20条,如何获取更多?
Hey there! I’ve worked with HERE’s Places API before, so I can help you get past that 20-result limit. The issue is that you’re using the wrong parameter—HERE’s Discover Search endpoint doesn’t recognize limit; instead, it uses pagination parameters to load more results. Here’s what you need to do:
1. Use size to increase results per page
The size parameter controls how many results you get per request, and you can set it up to a maximum of 100 (the default is 20). Add this to your query string to pull more results in one go.
2. Use page to fetch subsequent pages
Once you’ve set your desired size, use the page parameter to navigate through result sets. Start with page=1 for the first batch, then increment the number by 1 each time you make a new request to get the next set of results.
Example Request
Here’s your original query updated with these parameters (set to 100 results per page, second page):
https://places.cit.api.here.com/places/v1/discover/search?app_id=APP_ID&app_code=APP_CODE&in=-102.65625,-73.71566303112276,102.03125238418579,74.2119976769519&pretty&q=accommodation&size=100&page=2
Quick Tips
- Keep requesting new pages until the response returns fewer results than your specified
size(or an empty result set)—that means you’ve grabbed all available accommodation listings in your area. - Remember,
sizecan’t go over 100, so if you need hundreds of results, you’ll have to loop through multiple page requests. - Double-check your API quota to make sure you don’t hit any limits with repeated requests.
内容的提问来源于stack exchange,提问作者nico

