Skip to main content

Hi,

We are trying to read files using BOX API. Users to my application will just send the file URL and we need to download the file and process.
My application is written Java ( Spring Boot).
User can send file URL from their own accounts also.
From the docs, i got the below code. But I have couple of basic questions.
How to get authenticated to Box and what is the "id" in the constructor for BoxFile?


BoxFile file = new BoxFile(api, "id");
BoxFile.Info info = file.getInfo();

FileOutputStream stream = new FileOutputStream(info.getName());
file.download(stream);
stream.close();

Can you please help here?

 

Thanks
SD


Hi ,


 


To get authenticated with Box, you can use this guide to set up a JWT application, and this guide will walk you through the auth process.


 


That id param is the Box file ID. You can get a file ID in a few different ways:


  1. Through the APIs, generally you will get file information when you upload a file via (return JSON includes the file ID), or if you are searching for particular files to download using the search endpoint, or if you are retrieving a list of files in a given folder.

  2. If you load up the file visually in box.com, the URL should look something like https://cloud.app.box.com/file/33456445430. The last series of numbers in the URL for a file or folder will always be the ID of that file or folder.

Hope that helps,


Jon



Hi Jon,

Thanks a lot for the help. I am working on it now.



Hi  

 

I have created a application and submitted for authentication. How long generally will it take for approval.

Any restriction on creating application?

AppId - 1336620

 

Thanks

Subba



Reply