You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

 blueli's avatar
blueli
Explorer | Level 4
5 months ago

How to correctly use the /files/list_folder/continue endpoint to retrieve the latest added files?

Hello

So basically I am working on automation. However, I cannot figure out how to use the "cursor" correctly.

My flow is simple. 

1. A webhook is triggered by new files added to Dropbox.

2. Use POST /2/files/list_folder to list all files from a specific folder and obtain a cursor.

3. Use POST /2/files/list_folder/continue with the cursor obtained in step 2. It will not return any results unless we continue with a cursor obtained before new files were added.

4. Upload those latest added files to somewhere else.

 

But how can we obtain the correct cursor (previous state) for step 3 to retrieve the latest added files for step 4?

 

Thanks


  • blueli wrote:

    ...

    But I can only get the latest added items from the cursor from step 0 for the step 3 


    According your explanation, that's what you try to do. Right? Correct me if I misunderstood something.

    Once you keep the CURRENT last cursor, received from the last call to /2/files/list_folder/continue, the next time of execution with this cursor /2/files/list_folder/continue will give you the next changed things (files and/or folders). You have to save again the new latest cursor that will become the new current till the next change etc.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    blueli wrote:

    ...

    But how can we obtain the correct cursor (previous state) for step 3 to retrieve the latest added files for step 4?

    ...


    Hi blueli,

    You can do it in the same way as you have it done in step 2. 😉 The result has the same format.

    Hope this helps.

    •  blueli's avatar
      blueli
      Explorer | Level 4

      0. Use POST /2/files/list_folder to list all files from a specific folder and obtain a cursor.  

      1. A webhook is triggered by new files added to Dropbox.

      2. Use POST /2/files/list_folder to list all files from a specific folder and obtain a cursor.

      3. Use POST /2/files/list_folder/continue with the cursor obtained in step 2. It will not return any results unless we continue with a cursor obtained before new files were added.

      4. Upload those latest added files to somewhere else.

       

      But I can only get the latest added items from the cursor from step 0 for the step 3 

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        blueli wrote:

        ...

        But I can only get the latest added items from the cursor from step 0 for the step 3 


        According your explanation, that's what you try to do. Right? Correct me if I misunderstood something.

        Once you keep the CURRENT last cursor, received from the last call to /2/files/list_folder/continue, the next time of execution with this cursor /2/files/list_folder/continue will give you the next changed things (files and/or folders). You have to save again the new latest cursor that will become the new current till the next change etc.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,883 PostsLatest Activity: 15 minutes ago
326 Following

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!