Shared Links API

Answered
New post

Comments

21 comments

  • kendomen

    here's a box-java-sdk example...

     

    BoxDeveloperEditionAPIConnection userApi = BoxDeveloperEditionAPIConnection.getAppUserConnection(managedUser.getID(), CLIENT_ID, CLIENT_SECRET, encryptionPref, accessTokenCache);
    
    BoxFolder boxFolder = new BoxFolder(userApi, "");
    
    BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions();
    permissions.setCanDownload(true);
    permissions.setCanPreview(true);
    
    Iterable items = boxFolder.getChildren();
    for (BoxItem.Info item : items) {
        if (item instanceof BoxFile.Info) {
           BoxFile.Info fileInto = (BoxFile.Info) item;
           BoxFile file = new BoxFile(userApi, fileInto.getID());
           file.createSharedLink(BoxSharedLink.Access.OPEN, null, permissions);
        }   
    }
    0
    Comment actions Permalink
  • htstl01

    Thank you for that. I'm not familiar with the Java SDK, but I'll try and fumlbe through it. 

    0
    Comment actions Permalink
  • robwhoisnew

    A follow-up question. First is there an example of this in python?

     

    Second is there a way to generate custom URLs for share links in the API?

    0
    Comment actions Permalink
  • remixhuddle

    Hello what are the steps and how i can do this? i really need this! 

     

    Thanks

    0
    Comment actions Permalink
  • htstl01

    I've built out a jar file to do this. doing some debugging but can share when complete. 

    0
    Comment actions Permalink
  • remixhuddle

    more or less when would you be complete with this? lol hope you can make this happen!

    0
    Comment actions Permalink
  • remixhuddle

    any luck using that code?

    0
    Comment actions Permalink
  • htstl01

    Yes! Code takes a whole folder, and generates shared links for each file present and dumps to a csv file. I had some help because some of its above my pay grade. had a friend add multi threading too. It works but needs a little more debugging due to authentication with box. hopefully wrap it up this week. 

    0
    Comment actions Permalink
  • remixhuddle

    Great! Hope to hear from this soon. Thanks

    0
    Comment actions Permalink
  • remixhuddle

    Did you get to use this method? i want to know if this works?

    0
    Comment actions Permalink
  • htstl01

    It's working! Sometimes getting error codes through. Figuring out why.

    0
    Comment actions Permalink
  • htstl01

    What type of account do you have? Personal or enterprise? Governance package?

    0
    Comment actions Permalink
  • sarinburritos34

    Came across this thread recently with similar requirement.

    Were you able to fix the issue you mentioned? And have you shared this code anywhere?

    Thanks

    0
    Comment actions Permalink
  • htstl01

    Yes, I did finally get it working. I haven't posted the code anywhere, though. I have a .jar executable if one is interested. 

    0
    Comment actions Permalink
  • jotter_getice

    I would be interested in checking out this tool! Currently I have zapier sharing files that get added to a folder, but would be nice to do this as a batch without using my zapier tasks.

    0
    Comment actions Permalink
  • Victor8

    If I have 1000 files in the folder, will this code produce 1000 separate requests? If yes, is there any way I can make a bulk update?

    0
    Comment actions Permalink
  • JimBuell

    Hi . Just encountering your message in this thread nearly a year after you posted, as I'm looking to solve the same kind of problem. I for one would love to get a look at your solution.

     

    Seems like there are quite a few digital archivists using box.com for their file storage, who'd love a way to create spreadsheets of share links to that back-end content, for use with content-managed websites in searchable/sortable/filterable ways. Without an automated way to create those links, all of us need to use the ordinary box.com file interface and create every link by hand, then paste it into a spreadsheet row and add metadata columns, before being able to use that spreadsheet as the engine within a content-managed front end such as a WordPress site with a forms manager plugin.

     

    I'm guessing that the sort of tool you describe having created, would be a great addition to the codepen examples at https://codepen.io/box-platform/pens/popular/?grid_type=list. Thanks for making the community aware of your work!

     

    Jim

    0
    Comment actions Permalink
  • htstl01

    Hi Jim, whats the best way to get you the source code (java)?

    0
    Comment actions Permalink
  • JimBuell

    Hi  . I've just sent you my email address in a private message. Thanks!!

    0
    Comment actions Permalink
  • haikachu

    This is awesome. Exactly what I am looking for. Can the code be downloaded somewhere?

     

    Thanks!

    0
    Comment actions Permalink
  • htstl01

    Send me a private message and I'll email  it.

    0
    Comment actions Permalink

Please sign in to leave a comment.