Please list all Box File URLs, their availability and functionality
I'm using box-java-sdk-2.32.0.jar and having some problems. Right now: with URLs.
A) BoxFile.Info's getDownloadURL() returns a 1.3k string. Last week when I put it into the browser nav bar, the Box GUI came up and I could view the file directly. This week I get a permissions error suggesting I use a Shared Link. I cannot confirm if the URL has changed, but grabbing current BoxFile.Info does NOT give me a valid one.
A.i) is this a permanent URL or does it time out?
A.ii) is there an administrative setting which could have turned off downloading for a directory or user?
B) BoxFile.Info's getPreviewLink() says in the API that it lasts 15 seconds. So I cannot cache that.
B.i) Does that URL return an image of the file?
B.ii) I'm told that our front end people cannot make arbitrary calls to Box to generate JIT preview URLs because of CORS, so we have to create a pass-through endpoint to return said URLs.
C) BoxSharedLink only exists for files if the user clicks the Share control to ON in the GUI.
When it exists, the DownloadURL does actually download the file.
C.i) Are there events for Sharing/unsharing?
C.ii) More importantly, can I use Box API calls to force a file to be shared (since all of them should be for this application) - and get the URL returned from the call?
C.iii) What is the boxSharedLink.getURL() useful for?
D.i) Are there any other expirations/lifetime limits to the above URLs?
D.ii) are there other BoxFile-related URLs we should be looking into to provide the Download and Preview functionality that we need?
Thanks!
-
Hi ,
Let me see if I can answer your questions here:
- A) To create a shared link for a file you'll want to call the Create Shared Link endpoint. That will return you a valid shared link.
- Ai) It can be either. Setting the unshare_at value will allow you to have a shared link that expires after a certain amount of time.
- Aii) Yes, depending on your access level you may not have the ability to download files. Here's a handy list that shows the access rights for different collaborator settings. The admin can also automatically apply settings to shared links, such as expiration time and notification settings.
- B / Bi) For different types of previews (e.g. image / PDF / etc) I'd recommend looking at the Representation endpoints. I believe that will give you what you're looking for.
- Bii) When setting up your application within the developer console you'll be able to set CORS domains at the bottom of the configuration section of the app. That should solve that issue.
- C) Another option is to use the download file endpoint to download file content. That will probably be an easier method directly in your application.
- Ci) Yes, we have our events listed here. There are events for ITEM_SHARED, ITEM_SHARED_CREATE, and ITEM_SHARED_UNSHARE.
- Cii / Ciii) See A) for this one - you can create shared links with that endpoint.
- Di) Just the expiration times that you or the admin set.
- Dii) I'd recommend the ones that I mentioned in the previous sections (create shared link, representations, and download file)
Hope that helps,
Jon
Please sign in to leave a comment.
Comments
1 comment