Welcome to the new Box Support website. Check out all the details here on what’s changed.

Is there an automated way to create shared links to folders

New post

Comments

4 comments

  • Rui Barbosa

    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.

     

    0
    Comment actions Permalink
  • Rey Garcia

    Hi Rui,

    Thank you so much for the information.  I will give this a shot and see what what happens!  I'll keep you posted.

    Rey

    0
    Comment actions Permalink
  • Rey Garcia

    Hi Rui,

    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

    0
    Comment actions Permalink
  • Rui Barbosa

    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.csv

    from 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

     

     

     

    0
    Comment actions Permalink

Post is closed for comments.