Learn how to make the most out of the Dropbox Community here 💙!
Forum Discussion
og19
8 days agoNew member | Level 1
Iterating through results of sharing_list_shared_links()
What is the right way to iterate through the results of calling sharing_list_shared_links()? I have this code: # Initial request response = dbx.sharing_list_shared_links() ...
DB-Des
Dropbox Engineer
5 days agoHi og19,
Your code appears correct, and this can be confirmed by the fact that you are getting a successful (200) response from the API.
Keep in mind that depending on the usage pattern and current state of the account, it is possible for the /sharing/list_shared_links endpoint to return successful responses containing an empty links list, with a new cursor and has_more set to true. Your app will still need to page through each response to retrieve all results. The exact size of the links list in any particular result and the number of pages used is not guaranteed and may vary by account and over time. The links list may sometimes contain no entries for some accounts and calls.
That said, would it work for you to call /sharing/list_shared_links with the path set to the path of a each specific file in question, and direct_only set to True? This might scale more predictably, as it would avoid the issue of potentially having to page through multiple pages of empty results.
og19
5 days agoNew member | Level 1
Thanks DB-Des –
What is the correct way of interating through the results when links is empty and has_more is True? Is the cursor itself a link?
I have printed out all the data that is being returned, as you can see – I'm not sure what else can be done.
I do not know the paths a priori – I need to find all the links and expire all the ones that are older than a certain amount.
- DB-Des4 days ago
Dropbox Engineer
og19,
A cursor is encoded information associated with the API call that helps maintain the state between paginated requests. This information could include (but is not limited to), the time and date of the request, parameter values, account information, position of the last retrieved item, etc.
Could you confirm what the highest amount of requests is that you have iterated through that contain empty links and has_more=True?
Are you also able to provide 5-10 different 'X-Dropbox-Request-Id' response header values for requests that have returned empty links and has_more=True?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,972 PostsLatest Activity: 5 hours ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!