Is there an automated way to create shared links to folders
Is there an automated way to created shared public links as opposed to going into each folder and creating the links via the Share button?
We have an archive of 2.5 million images on Box that we'd like to publicly share along with a searchable database containing information about those images (using Airtable). Each image folder on Box is labeled with a "job number" that correlates to a record on Airtable containing information about that set or job of images. It seems we have 2 options to do so, though neither is ideal:
1) Share one public Box link to the entire folder/subfolders of images. The issue is in order for users to be able to search for the job numbers on Box, users would need to create a free Box account and we would have to manually grant each user account permission. Otherwise, users would need to navigate to the correct job folder to view the images, which could take a lot of time.
2) Create shared links to each subfolder of images (~100,000) and add those links to the records in Airtable. If shared links can only be created one folder at a time, this would take a lot of time.
We've also explored the Airtable/Box integration, but it appears that it is limited to 10,000 records. https://support.airtable.com/hc/en-us/articles/1500003393381-Airtable-Sync-integration-Box
I'm wondering if there's any other solutions to make this process more efficient (i.e. is there an automated way to create shared links to folders?)
-
Hi Rey,
I'm intrigued by your use case, and was doing some tests, trying to break the problem into more manageable pieces.
My first take is wondering if the box CLI bulk command can help you set the share links for the 100,000 folders.
So I've created a .csv with only itemType = folder and itemID as each folder id.
Then run the command:
box shared-links:create -v -y --bulk-file-path=myfolders.csv --access=open --can-download --no-can-edit --csv --save-to-file-path=results.csv
It takes about 350 ms for each call, which doesn't seem very different from a manual API call. For 100.000 folders, that is shy of 10 hours.
I'm not sure if this is acceptable or if you could do this in batches...
Lets us know and we'll continue to explore this.
-
So, I have been trying to get this to work but have not been successful in doing so. I apologize but I am not familiar with CLI very much. Would you mind sharing with me the command to get the file with the share links if the folder is located at Box>all files>personal>photos ?
And I am assuming I will have to create a folder on my local computer to dump this information to, right? Or will the CLI create that the file output for me?
Thank you once again for any help you can provide.
Rey
-
Hi Rey,
My understanding of your use case was to create shared link to approximately 100,000 folders.
To do this in bulk you'll need the id's of those folders.
In my example I started by creating a list of all folders under a specific folder, in my case folder id 170848662143, and output that list into a csv file.
# create folder list
box folders:items 170848662143 --csv --fields=id,name --save-to-file-path=myfolders.csvfrom there I had to change the column name on the csv file from itemId to id
# output csv file
itemType,itemID,sequence_id,etag,name,SharedLinkAccess
folder,172110514260,0,0,Eagle Ray Bay,company
...
# modified csv file
itemType,ID,sequence_id,etag,name,SharedLinkAccess
folder,172110514260,0,0,Eagle Ray Bay,company
...Then I run the create shared link command, using the csv file as an input.
box shared-links:create -v -y --bulk-file-path=myfolders.csv --access=open --can-download --no-can-edit --csv --save-to-file-path=results.csv
and got the list of the shared links.
# results.csv
url,effective_access,effective_permission,is_password_enabled,...,permissions.can_edit
https://app.box.com/s/bfxafuj6kxpp5v0rxhxy6pe348649ntn,open,can_download,,0,0,open,1,1,
...I'm not sure this approach will work for you, I'm just trying to solve the problem of creating shared links in bulk, and if the time it takes will work for you, for now.
About the CLI, take a look at our getting started here, and yes, the examples above will create the csv files in your computer locally.
Let us know if this helps.
Cheers
投稿コメントは受け付けていません。
コメント
4件のコメント