API Delete of a Share using a Share ID...

  • 1
  • Question
  • Updated 2 months ago
Hello,

 I am integrating the ShareFile function into our Customer Portal using the ShareFile APIs.  We are allowing out customers to Upload files to us using the RequestShare API.  I create a RequestShare and our customers can then upload files to us.  Working great.

 What I need to do is to limit the lifespan of the link that I create.  I am setting the ExpirationDate to manage the amount of time that the link will remain active (this feature is working for me), but I also want to disable the link when our customers log out of our portal.  The idea is to limit the link's usefulness to the shortest period of time possible.

 My idea was to keep track of the RequestShare's ID and then upon logout, call the DeleteShare API.  This is the http DELETE to https://<company>.sf-api.com/sf/v3/Shares(id).  Am I correct in thinking that after performing the Delete that I would expect the Share that I created to no longer work?

 I am able to send the http DELETE.  I receive a status code of 204 with a message of "No Content".  I believe this is the correct response to this request.

 However, when I attempt to use the RequestShare link that was previously created, it appears to be operational (it still works).  Also, if I get a list of Shares (https://<company>.sf-api.com/sf/v3/Shares), the Share shows up in the list.  It was never deleted.

 Am I using the Delete Share API correctly?  Should I expect the share to continue to be active after the delete?  Is there a different way to accomplish what I am trying to do?

 Thank you for your time!

Scott
Photo of Scott Parks

Scott Parks

  • 4 Posts
  • 0 Reply Likes

Posted 2 months ago

  • 1
Photo of Jordan Healey

Jordan Healey

  • 7 Posts
  • 0 Reply Likes
I am having the same issue. I am setting the expiry date of the share to past the current day and the share is still visible
Photo of Scott Parks

Scott Parks

  • 4 Posts
  • 0 Reply Likes
Jordan, This is what I noticed after calling the DeleteShare API...

The Share is still visible when I query the list of Shares, but I noticed that the Share that I previously created had its expiry date modified so that it was already marked as expired.  The DeleteShare() API doesn't remove the Share from the list of Shares that are being tracked, it just modifies the Expiration date.

 So given that, when you test the Share that has just recently been marked as Expired, you need to be careful.  What I noticed was that if the browser page containing the active share link is still displayed, it will work (or at least act like it works (this was a little confusing)).  You would need to clear your browser's cache or attempt to reload the link to the Share (or attempt to do so in another browser).  If you do one of these things, then, you'll get a screen that states that the link is no longer active.  That was *mostly* what we were expecting to see.  We want the Share to be disabled after use.  This could be a period of time (5 to 10 minutes) or at logout (or session timeout).  We don't want links to active Shares being able to be passed around.

 Also, Jordan, you state that you're setting the expiry date 'past' the current date.  You need to set the date to something prior the current date so that the Share is expired.  Possibly, this is what you meant to say.

Scott