Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
maxior1234
4 years agoExplorer | Level 3
/list_folder/get_latest_cursor -> shared_link
Hello, I noticed that for get_latest_cursor you can add a shared_link parameter. If I understand the documentation correctly, this parameter allows you to get the cursor for a file whose name is contained in the url. However, I have a problem with creating json with parameters in which there is a shared_link parameter. How such json should look like? is this right?
{
"path": "/ SZOtestowe",
"shared_link": {"url": "https://www.dropbox.com/s/t7a0cbikc4s318i/orze%C5%82-2.jpg?dl=0", "password": ""}
}
11 Replies
- Greg-DB4 years ago
Dropbox Community Moderator
I see you're referring to using the /2/files/list_folder/get_latest_cursor endpoint. That endpoint allows you to get a cursor for listing a folder. That allows you to specify either a path in the connected account, or a shared link for a folder and optionally a path relative to that folder.
The structure of your JSON looks fine for the latter case, but I do see two issues with the values:
- your shared link appears to be for a file, not a folder; this endpoint is for listing the contents of folders, so supplying a shared link for a file won't work
- you have an empty "password" field; I don't know if you just redacted it for the sake of posting this, but if there isn't a password for the shared link, you don't need to set the "password" field at all
By the way, the API v2 Explorer can helpful for constructing and testing calls like this. Click the "Show Code" button to see the constructed code.
- Здравко4 years agoLegendary | Level 20
maxior1234 wrote:... If I understand the documentation correctly, this parameter allows you to get the cursor for a file whose name is contained in the url. ...
Hi maxior1234,
No, 🙂 You don't understand correctly. Such cursors, received from wherever (including from /2/files/list_folder/get_latest_cursor), target to a folder, not a file!!! They represent current enumeration state. How you "understand" particular single file enumeration (file pointed by a link in your case)? 😉
The "path" here means a subfolder path within a folder tree pointed by a provided link eventually (when your target is not the entire tree, but some subpart). A file can't have a subfolder, as it, by self, is not a folder!
Hope this clarifies matter.
- maxior12344 years agoExplorer | Level 3
I have an automation that gets information about newly added files to a Google sheet. The current cursor Dropbox is also saved in the sheet. The problem arises when the automation somehow loses its cursor. Then I get the information about the files from the beginning into cursor. I would like to improve it. Is it possible to read from Dropbox cursor from a specific position? For example, in sheet, I have a file name and a link to this file. Can I get a cursor on the basis of this information, thanks to which I will be able to retrieve information about subsequent files?
- maxior12344 years agoExplorer | Level 3
I would need a cursor to be able to get the next files in the folder. For example, I have downloaded information (file name, etc.) about some of the files in the Dropbox folder. Information about files is downloaded to a file named x.jpg. I miss the cursor value. How can I get information about the next files in the Dropbox folder, but not from the beginning?
- Здравко4 years agoLegendary | Level 20
Hi maxior1234,
As far as you are correctly describing what you want, it's a cursor actually. As I mentioned cursor describe current enumeration state, nothing else. If the added files (past the last cursor) are not too much, you can add them to your sheet by hand and use the /2/files/list_folder/get_latest_cursor call (applied to containing folder, not to a file) to get the actual (latest in this case) cursor and continue further. Otherwise you have to start listing from beginning. To avoid such "incidents", review why you have lost your cursor and take measures (if changes in the file is the reason, keep/backup the cursor in alternative file for instance - don't rely on insecure storage).
Good luck.
- maxior12344 years agoExplorer | Level 3
Does cursor have any life expectancy? For example, it happens that tokens expire after a certain period of time, or is it similar with cursor?
- Здравко4 years agoLegendary | Level 20
No, no... Definitely not. Cursor doesn't expire. Just check why you have it lost (if you lost it, why you have doubts it expires 🧐)! Only this will let you fix the issue and avoid further "incidents". 😉 You may have some weaknesses in your application algorithm. Check this too.
- maxior12344 years agoExplorer | Level 3
I am wondering about one solution? Currently cursor saves in one place. Since I download information about files one at a time, it gets another cursor after each download. If I were to write cursor on the same line as the file information, maybe this would help to eliminate this situation. If so, I would always have the cursor either the last one, or at least before the last one. Separating the cursor from the rest is also good, but it doesn't rule out my mistake, for example. In the sense that I will accidentally replace it with the wrong cursor. I have some of the same automations that work the same but use different places in the dropbox. On the other hand, the option that I am writing about a moment earlier is more difficult to implement.
- Здравко4 years agoLegendary | Level 20
maxior1234, Only you know how exactly your application works (or how it's supposed to, at least). That's why I can't comment what's the best. Again without clearance why you get you cursor lost, you are speculating here and force others to speculate too! For sure you need to clarify the reason and after that the solution.
About to "write cursor on the same line as the file information". 🤔 It's not a good idea. Dropbox doesn't guarantee you can get such a cursor for every single file! Again cursor represent enumeration state; one enumeration step can enumerate from zero to multiple entries (in spite of you can point some count). Providing a count of entries represent your wish and it's not mandatory for Dropbox (Dropbox will try to cover your wish). This make such a way very "slippery"! Don't do this if you are not sure what exactly you are doing.
- maxior12344 years agoExplorer | Level 3
I have several such automations. Each of them retrieves information about files from a different but specific folder. When it needs the same additional automation, it creates a folder in Dropbox. I connect an automation that obtains a cursor (for a specific folder) and saves it to the appropriate tab in the sheet (to the second tab). Then I drop the files into this new folder. I restart the automation, which now downloads information about the added files to the first tab. As the files are downloaded one at a time, it also receives a new cursor each time and saves it to the second tab. With each downloaded file, the cursor is overwritten in tab 2, i.e. I have one fixed location for the cursor. In theory, since these cursors are for an enumeration in a specific folder, cursor should probably not be showing files in the wrong folder, but it could be different. If the automation were to load files from the wrong folder, this cannot happen. I am not sure, because there are several of the same automations, it is possible that I could even put something wrong. Thanks for your help, it will save the cursors to another file.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!