I’m selecting several services and only getting limited data. How do I attemtped to receive “unlimited” data back?
'data: { results: [], total_pages: 87 }'
when I do not specify a "pages" parm I only get 25 results
when I specify a "pages" of 100 I go NO data back.
Do I have to call the API once to determine the number of pages then again setting the number of pages?
아래에 의견을 추가하고 토론에 참여하세요.
Hi,
To query the whole data, you need to first send a request with page=1 or without a page parameter (note that there’s no “pages” parameter, there’s only “page”). Consume the data in the results, then check the “total_pages” and send a new request for each page. i.e. if total_pages = 5, then you need to send extra requests with page=2, page=3, page=4, and page=5
Maximum amount of items for each request is 25 for Search Ultra endpoint. So if there’re 100 results, you’ll need to send 4 requests to get them all.
When you are setting “page” to 100, and the total pages are 87, that means you are querying a page that does not exists, thus the endpoint returns an empty array.
Hope this helps. Let me know if you any other questions.