Avi
Avi

Reputation: 972

accessing public Box folder using API

A government agency I work with posts data files on a publicly shared Box account every morning (link here). I'd like to programmatically pull down the files from that day using the Box API. However, I'm having great difficulty figuring this out, as all the documentation I've seen so far regarding the Box API involves accessing files from your own Box account (or one which you have the credentials for). This is not my Box account, so I don't have those credentials, but the data is intended to be freely accessible to the public. How would I go about doing this?

I'm working in .NET, but if the steps are laid out for me in another language I think I'd be able to adapt it from there.

Thank you very much.

Upvotes: 1

Views: 474

Answers (1)

kendomen
kendomen

Reputation: 778

I was able to get it like this using box-java-sdk:

 BoxDeveloperEditionAPIConnection userApi = BoxDeveloperEditionAPIConnection.getAppUserConnection(managedUser.getID(), CLIENT_ID, CLIENT_SECRET, encryptionPref, accessTokenCache);

            BoxItem.Info boxItem = BoxFolder.getSharedItem(api, "https://hpdnyc.app.box.com/s/zjq4iwixgn44gvqt43ou4jmiqfehemkc");
            BoxFolder publicFolder = (BoxFolder)boxItem.getResource();
            Iterable<com.box.sdk.BoxItem.Info> items = publicFolder.getChildren();
            for (BoxItem.Info item : items) {
                System.out.println("\t" + item.getName());
            }

The output is:

Ken.Domen.Test ACTIVE Complaints20170126.zip Complaints20170127.zip Complaints20170128.zip Complaints20170129.zip Complaints20170130.zip Complaints20170131.zip Complaints20170201.zip Violations20170126.zip Violations20170127.zip Violations20170128.zip Violations20170129.zip Violations20170130.zip Violations20170131.zip Violations20170201.zip

Upvotes: 1

Related Questions