Pagination in Search API v2
Hi,
I'm using Search API v2 to get users detail and below is my python script.
import requests
url = "https://[COMMUNITY DOMAIN]/api/2.0/search?q=SELECT%20distinct%20id%20FROM%20users%20where%20last_visit_time%20%3E%3D%202024-02-01T00%3A00%3A00%20order by%20id%20asc"
headers = {'Authorization': '<access_token>'}
response = requests.get(url, headers=headers)
I successfully fetched the results using the Search API v2 to obtain user details. Furthermore, I received the next_cursor token for pagination. However, when attempting pagination using this token, I encountered an issue where subsequent requests with the cursor parameter appended to the URL or passed as a parameter yielded the same results as the initial API call.
1. adding cursor parameter to the url itself.
url = "https://[COMMUNITY DOMAIN]/api/2.0/search?q=SELECT%20distinct%20id%20FROM%20users%20where%20last_visit_time%20%3E%3D%202024-02-01T00%3A00%3A00%20order by%20id%20asc&cursor=<next_cursor>"
2. pass next_cursor as parameter
request.get(url,headers, params={'cursor':<next_cursor>})
Could someone assist me in resolving this issue, or perhaps suggest an alternative approach to retrieving all the records?