Skip to main content

We are given a list of files to download where the URLs are in the form https://app.box.com/s/.  Looking for a way to programmatically download them using NodeJS. It doesn't appear that the is the same as file_id.

Hi  ,

 

You're correct - the shared link "hash" at the end of the URL is different from the File's actual ID.

 

Here's some reference for the call you're looking for:

https://developer.box.com/en/guides/downloads/shared-link/

 

You'll need to first obtain the file ID, and then make a subsequent API call to download the file with an additional header that signifies a download for a shared link.

 

It doesn't look like the node SDK supports this additional header natively:

https://github.com/box/box-node-sdk/blob/master/docs/files.md#download-a-file

 

But you might be able to construct the call with the additional header manually:

https://github.com/box/box-node-sdk/blob/master/docs/client.md#get

https://github.com/request/request#custom-http-headers

 

Hope that helps!

 

Thanks,

Jason