We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
latimba
6 years agoExplorer | Level 3
longpoll workflow / flowchart / advice how to do it right
Hello Dropbox API team, I built an app that loads and saves information from a single text file in Dropbox. That app could be used from several devices, mobile and desktop, and therefore has to det...
elsigh
Helpful | Level 5
I wonder if one thing not covered in this flow is, say, if the folder name is changed in Dropbox.. Maybe that's why they (and I) want to call `filesGetMetadata` as well on the folder in addition each time. Is there another/more efficient way to catch and handle that from the client side? I will double check that the longpoll doesn't return changes to the folder itself.. (it looks very `entities` focused)
Greg-DB
5 years agoDropbox Staff
elsigh Renaming a file or folder will be reflected by listFolder/listFolderContinue as a deletion of the item at the original path, and then an addition of the item at the new path.
The file ID doesn't change when renaming an item in Dropbox though, so tracking that value is the best what to correlate these.
- elsigh5 years agoHelpful | Level 5
Hey Greg-DB - ok that's great to know. I haven't gotten to testing renaming/deletion so I'll look out for that. But does that cover the folder being polled? e.g. if I'm polling a folder A and a user goes and renames folder A to folder B I would catch that somewhere?
I've been implementing as you suggested here but I'm wondering about two scenarios I'm seeing.
In one case I'm receiving a response with `changes: false` - I'm guessing in this case I should start the poll again with the same cursor?
In another case it seems that I'm getting `changes: true` so I subsequently call listFolderContinue with the cursor but then get a response that has `entries: []` but does come back with a new cursor.. in other words it seems like I'm not actually getting any changes so I wonder what's going on there? This pattern happens over and over without me making any changes within that folder. Is that expected?
- Greg-DB5 years agoDropbox Staff
elsigh wrote:
does that cover the folder being polled? e.g. if I'm polling a folder A and a user goes and renames folder A to folder B I would catch that somewhere?
Yes, if you listFolder for a path a particular folder and are polling using the returned cursor, you'll get `changes: true` if/when that folder itself is renamed. If you then listFolderContinue with that cursor, you'll accordingly get a `path/not_found` error, since that path no longer exists (or a `reset`, if you originally listed the folder via file ID). Alternatively, if you were listing a parent folder of the renamed folder, you'd see `changes: true` and the deletion/addition in the listFolderContinue result.
In one case I'm receiving a response with `changes: false` - I'm guessing in this case I should start the poll again with the same cursor?
That's correct, if/when you get `changes: false`, that means nothing has changed yet but that poll operation timed out, so you should start another poll call if you wish to keep monitoring for changes.
In another case it seems that I'm getting `changes: true` so I subsequently call listFolderContinue with the cursor but then get a response that has `entries: []` but does come back with a new cursor.. in other words it seems like I'm not actually getting any changes so I wonder what's going on there? This pattern happens over and over without me making any changes within that folder. Is that expected?
That sounds unexpected. Can you open a thread with the relevant code/steps to reproduce this, and the output, so we can investigate? Thanks in advance!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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!