Home > Back-end >  how to delete multiple folders using google drive api in javascript with axios?
how to delete multiple folders using google drive api in javascript with axios?

Time:02-21

I am trying to delete multiple files of google drive using google drive api but it give 404 error

axios.delete('https://www.googleapis.com/drive/v3/files',{
         params:{
             fileId:'1nJddic7Gc_x8NQBzwOPhglwfYI-_Ms5E,1nJddic7Gc_x8NQBzwOPhglwfYI-_Ms5E',
              supportsTeamDrives: 'false',
         },
         headers: {
            authorization: `Bearer ${accessToken}`
            }
        })
        .then(res=>{    console.log(res.data)   })
        .catch(err=>{    console.log(err)   })

CodePudding user response:

You have to pass the fileId as path parameter:

axios.delete('https://www.googleapis.com/drive/v3/files/1nJddic7Gc_x8NQBzwOPhglwfYI-_Ms5E,1nJddic7Gc_x8NQBzwOPhglwfYI-_Ms5E', {
  headers: {
    authorization: `Bearer ${accessToken}`
  }
})
.then(res => { console.log(res.data); })
.catch(err => { console.log(err); });
  • Related