Announcements
Do you have an idea for Dropbox Paper? Share it with us here!
Highlighted

Files Delete batch

Explorer | Level 4

 

dbx.filesListFolder({path: '/app', recursive: true})
    .then(response => {

      let path = response.entries.map(entry => {
        return {path: entry.path_lower};
      })
 
      dbx.filesDeleteBatch({entries: path})
      .then(response => {
        console.log(response);
      })
    })

Hi there, I am trying to delete several files/folders at once, however, when I use the 'filesDeleteBatch' method it does not delete anything. Its response in the '.then()' looks like this: 

{ '.tag': 'async_job_id', async_job_id: '...idNumber...' }

How can i solve this problem?

Thank you

 

3 Replies

Re: Files Delete batch

Dropboxer

The filesDeleteBatch method does not necessarilly immediately delete the requested files. It can create and return the ID for an asynchronous job.

 

You should use the filesDeleteBatchCheck method, supplying the async job ID you received from filesDeleteBatch, to check on the job's status. If the job failed, it will indicate why.

Reply
Loading...

Re: Files Delete batch

Explorer | Level 4

so this means that we need to periodically check manually by sending the hit to `delete_batch/check` API endpoint. 

Isnt there any way that we can use webhook against the delete_batch which should automatically submit the payload to the given URL?

This feature can be useful.

Reply
Loading...

Re: Files Delete batch

Dropboxer

@buttflattery Yes, when the API returns an async job like this, you'll need to use the relevant endpoint to periodically check the status of the job until it's done.

The Dropbox API doesn't offer webhook functionality for this, or any other way to be automatically notified of async job status changes, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

Reply
Loading...
API Support

Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.

Not the right discussion for you? Find out what else our Community has to say about API Support.

Or, search our Help Center for even more.

Who's talking
Top contributors to this post