sendspace Developer | Documentation

Home
API Howto
Full API Guide
API Keys
Downloads
API Support

sendspace API (beta) Developer Guide

The sendspace Application Programming Interface (API) allows you to embed sendspace services in your applications, programs, or scripts, regardless of platform and programming language.

All communication with the sendspace API (beta) assumes a UTF-8 encoding.

 


< Return to Method List

Method: anonymous.uploadGetInfo

Description
Obtains the basic information needed to make an anonymous upload. This method does not require authentication or login.
Arguments
Name Mandatory Description
speed_limit No Upload speed limit in kilobytes, 0 for unlimited
api_key Yes Received from sendspace
api_version Yes 1.0
app_version No Application specific, formatting / style is up to you
Returns
URL to upload the file to, progress_url for real-time progress information, max_file_size for max size current user can upload, upload_identifier & extra_info to be passed in the upload form
Response
 
<result method="anonymous.uploadgetinfo" status="ok">
    <upload url="" progress_url="" max_file_size="" upload_identifier="" extra_info="" />
</result>


Possible Errors
Code Name Description
5 API_ERROR_BAD_API_VERSION Unknown or unsupported API version
When Upload Ends

If redirect_url was given, it will redirect to the URL, also adding two extra URL params to it:
* upload_status: ok/fail
* file_id: file_id (can be used in the API for later)
If no redirect_url is given, an xml page with following format will be sent:
 
<upload_done>
    <status>ok</status>
    <download_url>http://www.sendspace.com/file/XXXXX</download_url>
    <delete_url>http://www.sendspace.com/delete/XXXXX/YYYY</delete_url>
    <file_id>XXXXX</file_id>
</upload_done>


Progress Bar

Reading from progress_url can give the following XML result:
 
<progress>
    <status>ok/fail/done</status>
    <eta>00:00:00</eta>
    <speed>50</speed> <!-- in kbps -->
    <uploaded_bytes>1000</uploaded_bytes> <!-- in bytes -->
    <total_size>50000</total_size> <!-- in bytes -->
    <elapsed>00:00:00</elapsed>
    <meter>0-100</meter> <!-- percentage of upload done -->
</progress>



Because Ajax, for security reasons, is unable to issue requests to hosts other than the host the pages originated from, you need to make use a proxy to read the progress information. For example:
 
<?
header("Content-type: text/xml");
echo file_get_contents($_REQUEST['url']);
?>