- Loading...
- No images or files uploaded yet.
|
|
ApiFunction_Upload and Download
download
To download a file, You can make a GET request of the form:
https://www.box.net/api/1.0/download/<auth_token>/<file_id>
This works just like a direct download link. However, you will not want this link to be displayed to anyone except for the applied user, as the auth_token here can be used in other API calls.
A sample download request would look like this:
https://www.box.net/api/1.0/download/0ef4e2b1be630554ffa4044c054b1954/542666
upload, overwrite, new_copy
To upload a file, you can send an HTTP POST request to:
https://upload.box.net/api/1.0/upload/<auth token>/<folder id> Note: Uploading a file to this URL will overwrite the file if a file by the same name already exists. You may want to programmatically check for the existence of a file of the same name, in the folder to which you are performing the upload.
If you wish to explicitly overwrite a particular file (useful especially for OpenBox Actions), send the request to:
https://upload.box.net/api/1.0/overwrite/<auth token>/<file_id> Note: You do not have to construct this URL manually if you are creating an OpenBox Action. The platform an overwrite_url as a Callback Parameter that you can receive automatically.
If you wish to make a new copy of a file that exists (and take the filename of that file and append "(<copy_number>)" to it):
https://upload.box.net/api/1.0/new_copy/<auth token>/<file id> Note: You do not have to construct this URL manually if you are creating an OpenBox Action. The platform an new_copy_url as a Callback Parameter that you can receive automatically.
Input parameters:
Aside from using the auth_token and folder_id or file_id in the URL itself, you can provide the following parameters for your upload request.
Output parameters:
Sample Upload Request
As a simple example to upload to Box via the API , consider creating an HTML form. An upload might look like the following:
<form action="https://upload.box.net/api/1.0/upload/0ef4e2b1be630554ffa4044c054b1954/756" enctype="multipart/form-data" method="POST"> <input type="file" name="new_file1" /> <input type="file" name="new_file2" /> <input type="text" name="share" value="1" /> <input type="text" name="message" value="Hello" /> <input type="text" name="emails[]" value="test@domain.com" /> <input type="text" name="emails[]" value="test1@domain.com" /> <input type="submit" name="upload_files" value="Upload File" /> </form>
Response format
<?xml version='1.0' encoding='UTF-8' ?> <response> <status>upload_ok</status> <files> <file file_name="read_me.txt" id="5996" folder_id="756" shared="0" public_name="" /> <file file_name="Rally.avi" error="filesize_limit_exceeded" /> </files> </response>
Need additional assistance? Please feel free to Contact us
|