0

I'm testing out the new API, but having no luck downloading a test image file. The file exists, is accessible through the web UI, and is retrievable using the v1.0 API.

I'm able to access the metadata ("https://api.box.com/2.0/files/{fileid}") using both commandline curl and pycurl. However, calls to "https://api.box.com/2.0/files/{fileid}/data" bring back nothing. An earlier post (5/1) received the answer that the download feature had a bug and that "https://www.box.com" should be used as the base URL in the interim. That, however, just provokes a 404.

Please advise.

R Landry
  • 11
  • 2
  • That earlier answer meant to read replace 'https://api.box.com/2.0' with 'https://www.box.com/api/2.0' in your download requests. Does that work for you? – seanrose May 11 '12 at 00:30
  • That's probably the only permutation I hadn't tried... but no dice. I can get the metadata using that URL on the commandline, but a download call does nothing. – R Landry May 11 '12 at 01:22
  • Everyone so far has been able to make that work so this is strange. can you email us at api[at]boxDOTcom in order to troubleshoot this further with your particular API key? – seanrose May 11 '12 at 04:46

2 Answers2

2

You should be able to download via http://api.box.com/2.0/files/<fildID>/content ... Looks like we have a bug somewhere in the backend. Hope to have it fixed soon.

Update 11/13/2012 -- This got fixed at least a month ago. Just updated the URL to our newer format

Peter
  • 2,551
  • 1
  • 14
  • 20
0

For me it works when its /content instead of /data... python code below

import requests
    fileid = str(get_file_id(filenumber))
    url = https://api.box.com/2.0/files/1790744170/content
    r = requests.get(url=url, headers=<HEADERS>, proxies=<PROXIES>)
    infoprint("Downloading...")
    filerecieved = r.content
    filename = uni_get_id(fileid, "name", "file")
    f = open(filename, 'w+')
    infoprint("Writing...")
    f.write(filerecieved)
    f.close()
Icallitvera
  • 166
  • 1
  • 3
  • 13
  • I am trying to download a pdf file . The command i am using is curl https://box.com/api/2.0/files/fileid/content?version=10849 \-H "Authorization: Bearer token". fileid and token is not revealed because of privacy issues.Sorry But I am getting no output. The command shows no error as well. Could any one help – Neethu Lalitha Feb 18 '15 at 22:02