Shared Link is null
Hello,
I am trying to obtain all of the shared_links for a set folders within a folder. The issue that I am running into is that even though the folders are being shared, when I get all of the folders, I am seeing that the shared_link field is null.
I have been trying to figure out what exactly the issue is for quite some time and I am unable to a conclusion. I am currently using the Box Windows SDK.
-
You have to call the Create Shared Link endpoint to create a shared link for the new folder. Here's an example in Ruby showing how to do this.
require 'boxr' client = Boxr::Client.new('ACCESS_TOKEN') #Create a new folder and print out its item id new_folder = client.create_folder("Example Test Folder", "0") #creates a new folder in the user's root directory folder_id = new_folder.id puts folder_id #Get information about the new folder. The value for the shared_link property will be nil. folder_information = client.folder_from_id(folder_id, fields: []) puts folder_information #Create a shared link for the new folder client.create_shared_link_for_folder(folder_id, access: "company", unshared_at: nil, can_download: nil, can_preview: nil) #Get information about the new folder. The value for the shared_link property will be non nil. folder_information = client.folder_from_id(folder_id, fields: []) puts folder_information
-
I am having a similar issue.
I am trying to programmatically download all shared files but with I list them the shared link is always null even for those files which instead have it.
Calling the endpoint to create a shared link is not an option for our use case because the customer is trying to download files that they are manually sharing.
-
Hi all,
Was this problem solved for you. I also notice this behaviour. I created shared links for a file. I can see it via the user interface while being logged in as the owner. Via the API, logged in via an app user, the field "shared_link" is null. When I log in on the API with the owner account, the field does have the expected value. Apparently it has to do with permissions, but I even made the app user account co-owner on the item.
Appears to me, that for openly shared links, this fact should be available to anyone with access to the API. Am I wrong?
Koen
-
Hi, for me the problem was solved. The problem was entirely on my side. No matter if the item is shared entirely public, only users with access to the item get the value via the API. The app you registered to use the api also got a user in Box. You need to give that user access to the shared item. In my case, I had two apps with the same name (one disabled and one active) and I gave the wrong one access.
I hope this helps!
Koen
Please sign in to leave a comment.
Comments
9 comments