sharefile

How do I delete a ShareFile folder using the v3 ShareFile API?


I am trying to delete a folder in ShareFile using the v3 ShareFile Rest API. I'm migrating from the older v1 API, and the migration documentation cites /sf/v3/Items/BulkDeletePermanently as the replacement, but I cannot get it to work. Here is my bulk delete call and result:

POST https://[ShareFileHost].sharefile.com/sf/v3/Items/BulkDeletePermanently?ids=[folder id]
Returns:
   <code>BadRequest</code>
   <message>
      <lang>en-US</lang>
      <value>Missing Item Id</value>
   </message>
   <reason>BadRequest</reason>

I've tried this call with ids as a parameter and also with it as the Post QueryString and as PostData.

I also tried the DELETE with /sf/v3/Items. Here is my call and the result:

DELETE https://[ShareFileHost].sharefile.com/sf/v3/Items([folder id])
Returns:

       <code>Forbidden</code>
       <message>
          <lang>en-US</lang>
          <value>Authorization failed: Item.You are not authorized to perform this operation.</value>
       </message>
       <reason>NotAuthorized</reason>

I verified with this call that my user has delete capability for the folder I'm trying to delete. Any suggestions would be appreciated.


Solution

  • I found the answer to this. When looking at permissions, I was looking at my subfolder. The permissions needed to be on the parent folder. I created a parent folder and gave my user delete permissions. I then added a subfolder to it, and I was able to delete it using the DELETE with /sf/v3/Items.