16

I've created a direct link to a file in box:

enter image description here

The previous link is to the browser web interface, so I've then shared with a direct link:

enter image description here

However, if I download the file with a wget I receive garbage.

How can I download the file with wget?

Chris Snow
  • 23,813
  • 35
  • 144
  • 309

4 Answers4

17

I was able to download the file by making the link public, then replacing /s/ in the url with /shared/static

So my final command was:

curl -L  https://MYUNI.box.com/shared/static/EXAMPLEtzwosac6pz --output myfile.zip

This can probably be modified for wget.

0x90
  • 39,472
  • 36
  • 165
  • 245
robbwh
  • 337
  • 2
  • 9
6

I might be a bit late to the party, but FWIW:
I tried to do the same things in order to download a folder.
I went to the box UI and opened the browser's network tab on the developer tools. Then I clicked on download and copied as cURL the first link generated, it was something like (removed many headers and options for readability)

curl 'https://app.box.com/index.php?folder_id=122215143745&rm=box_v2_zip_folder'

The response of this request is a json object containing a link for downloading the folder:

{
  "use_zpdl": "true",
  "result": "success",
  "download_url": <somg long url>,
  "progress_reporting_url": <some other url>
}

I then executed wget -L <download_url> and was able to download the file using wget

eloqz
  • 127
  • 2
  • 6
3

The solution was to add the -L option to follow the HTTP redirect:

wget -v -O myfile.tgz -L https://ibm.box.com/shared/static/xxxxx.tgz
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
-1

What you can do in 2022 is something like this:

wget "https://your_university.app.box.com/index.php?rm=box_download_shared_file&vanity_name=your_private_name&file_id=f_your_file_id"

You can find this link in the POST method in an incognito under Google Chrome's network tab. Note that the double quotes escape characters.

Zhanwen Chen
  • 1,295
  • 17
  • 21