cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

/list_folder/get_latest_cursor -> shared_link

/list_folder/get_latest_cursor -> shared_link

maxior1234
Explorer | Level 3

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 11

Greg-DB
Dropbox Staff

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.

Здравко
Legendary | 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.

maxior1234
Explorer | 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?

 
 

 

 

maxior1234
Explorer | 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?

 
 

 

 

Здравко
Legendary | 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.

maxior1234
Explorer | 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?

Здравко
Legendary | 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.

maxior1234
Explorer | 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.

Здравко
Legendary | 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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    maxior1234 Explorer | Level 3
What do Dropbox user levels mean?