Shared Links API
AnsweredIs it possible to generate shared links for all files contained in a specific folder through the API? Thanks in advance!
-
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.
-
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
-
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); } }
Post is closed for comments.
Comments
21 comments