cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Organizing your research is important to easily review and share it. Learn how Kim uses Dropbox to gather and organize her research right 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: 
1
Ask
2
Comments

Getting 409 error when calling list_folder/continue on renamed folder

Getting 409 error when calling list_folder/continue on renamed folder

avivtzo
Explorer | Level 4

Hi guys,

I'm using your API in order to fetch the folders. I'm accessing the endpoint "/2/files/list_folder" for the first request and then using cursor I send the rest of the requests through "/2/files/list_folder/continue".

 

Everything works perfectly until I change the folder name in Dropbox(UI). Then, I get the following error - 409, Conflict (HTTP): {".tag":"path","path":{".tag":"not_found"}}.

My request contains {path: "/folderName"} but as I mentioned, I just renamed the folder name so the path is incorrect. I change the folder name in the Dropbox website so I have no way to identify this change (also tried to use webhook to see this change).

What am I missing ?

 

TIA 

 

1 Accepted Solution

Accepted Solutions

Re: Getting 409 error when calling list_folder/continue on renamed folder

Greg-DB
Dropboxer

That's correct, when listing a folder based on the folder's path, if the path changes the folder will no longer be found. 

Здравко's recommendation of using the folder's 'id' instead of the path is a good one. That is, when calling /2/files/list_folder, supply the folder's id (which starts with "id:") as the 'path' parameter. The id doesn't change when the folder is moved/renamed. (You may get a 'reset' error from /2/files/list_folder/continue in that case, but you can then easily start from /2/files/list_folder again with the same id.)

Alternatively, you could use /2/files/list_folder[/continue] for the folder's parent folder, whatever that may be, to keep track of changes to that parent folder's contents. (Note: the "path" value for the root folder itself is the empty string: "")

And yes, webhooks would only tell you when something changed, not what changed, so you would still need to use one of the above methods.

View solution in original post

5 Replies 5

Re: Getting 409 error when calling list_folder/continue on renamed folder

Здравко
Super Collaborator | Level 20

You don't miss anything. You are just trying access something missing (as noted in the error and described by you). That's it. Would be surprise if something else happens. To be sure that everything is consistent (at least some more) in dynamic environment don't use names, but ids and enumerate the things starting from the root, so if anything have changed you can catch it. The root is always the same. :wink:

Re: Getting 409 error when calling list_folder/continue on renamed folder

Greg-DB
Dropboxer

That's correct, when listing a folder based on the folder's path, if the path changes the folder will no longer be found. 

Здравко's recommendation of using the folder's 'id' instead of the path is a good one. That is, when calling /2/files/list_folder, supply the folder's id (which starts with "id:") as the 'path' parameter. The id doesn't change when the folder is moved/renamed. (You may get a 'reset' error from /2/files/list_folder/continue in that case, but you can then easily start from /2/files/list_folder again with the same id.)

Alternatively, you could use /2/files/list_folder[/continue] for the folder's parent folder, whatever that may be, to keep track of changes to that parent folder's contents. (Note: the "path" value for the root folder itself is the empty string: "")

And yes, webhooks would only tell you when something changed, not what changed, so you would still need to use one of the above methods.

Re: Getting 409 error when calling list_folder/continue on renamed folder

avivtzo
Explorer | Level 4

Thanks everyone, using ID as the path is definitely a better idea.

Re: Getting 409 error when calling list_folder/continue on renamed folder

avivtzo
Explorer | Level 4

Another question, when I get 'reset' error, why not using /get_latest_cursor with the folder ID instead of fetching the all folder (/2/files/list_folder) again ?

By getting the latest cursor I can continue my flow like nothing have been changed and I won't get all the files and folder again like I would if I use the /list_folder endpoint.

Thanks! 

Re: Getting 409 error when calling list_folder/continue on renamed folder

Greg-DB
Dropboxer

You can use /2/files/list_folder/get_latest_cursor if that works for your use case.

Keep in mind though that there is a race condition if you do so, with the possibility that you will miss some changes. That is, if something changes after your last successful update from /2/files/list_folder/continue and before your call to /2/files/list_folder/get_latest_cursor, you won't receive information about those change(s).

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    avivtzo Explorer | Level 4
  • User avatar
    Здравко Super Collaborator | Level 20
What do Dropbox user levels mean?
Need more support?