rehost.to API v1.0 beta (c) 2011 rehost.to - last modified 11.02.2011 ================================================================================ This API provides access to all neccessary functions to write your own tools to use our services. The following commands are available: cmd=login cmd=get_credits cmd=get_premium_credits cmd=get_total_file_count cmd=get_file_list cmd=delete_file cmd=get_upload_status cmd=get_new_long_ses cmd=logout cmd=get_supported_och_dl cmd=check_remote_file => See below for parameters, return value, description and examples. Note that the variable 'long_ses' is also the so called 'Premium Access Key'. If you are missing a function or encounter a bug please feel free to contact api@rehost.to. ================= FILE DOWNLOAD ================= To start a download you need to provide a 'user' user id and 'pass' password or the 'long_ses' / 'Premium Access Key' and the download link as an urlencoded string with key 'dl'. Example for user id and password: http://rehost.to/process_download.php?user=&pass=&dl= Example for 'Premium Access Key': http://rehost.to/process_download.php?user=cookie&pass=&dl= Please use a POST request if the encoded URL (download link) is not working (i.e. 'dl' variable is too long for GET request to be handled). Please note that file download is handled by 'process_download.php'. ================================================================================ cmd=login Parameter: user= pass= Returns: ses=,long_ses= on success 'ERROR: ' on error. Description: This function returns the neccessary variables ses (to operate with full access) and long_ses (to operate with limited access). Example: request: api.php?cmd=login&user=123456&pass=mylittlesecret reply: ses=24bcb4d0caa4120575bb45c8a156b651,long_ses=5f03faa873f97bcda89a51ec239dda666f3e72526f4e7f121742fd764fce9799942760417eeaa832c81fdd220261af158377de6adec1e6ca704d8322c4ec02aa ================================================================================ cmd=get_credits Parameter: ses= or long_ses= Returns: An Integer value for the amount of credits on success. 'ERROR: ' on error. Description: Execute this command to get the amount of credits available. Example: api.php?cmd=get_credits&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=get_premium_credits Parameter: ses= or long_ses= Returns: , '0,0' if user is not a premium user 'ERROR: ' on error. Description: With this function you identify a user as premium user if return value != '0,0'. The first value is the credit amount the user got left for the use of our services. The second value represents the UNIX timestamp when premium membership will expire. To calculate the Premium Upload Traffic left in MB devide the given value for by 0.1395089285714286. The Premium Download Traffic is represented by the value of devided by 1000 and multiplicated by 1024. Calculation: Return value (prem. credits): 2000 => Download Traffic: 2000 * 1024 / 1000 MB = 2048 MB => Upload Traffic: 2000 / 0.1395089285714286 MB = 14336 MB Example: api.php?cmd=get_premium_credits&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=get_total_file_count Parameter: ses= or long_ses= Returns: total= on success. 'ERROR: ' on error. Description: Function to get to know how many files are in the account of the given session. Example: api.php?cmd=get_total_file_count&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=get_file_list Parameter: start= length= ses= or long_ses= Returns: A JSON encoded array of the requested filelist on success, '0' if no entry was found for the requestet start position, 'ERROR: ' on error. Description: Used to receive all informations about the next 'length' (max: 100) files (uploads) starting from the entry at position 'start'. Example: api.php?cmd=get_file_list&start=0&length=10&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=delete_file Parameter: file= ses= Returns: 'TRUE' on success, 'ERROR: ' on error. Description: This API call will delete the given 'file' from the list of uploaded. You can only delete a file if you are the owner of the account and provide your valid 'ses'. Example: api.php?cmd=delete_file&file=75bb45c8a156b65124bcb4d0caa41205&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=get_upload_status Parameter: upload= ses= or long_ses= Returns: A JSON encoded array of the single upload parts on success, 'ERROR: ' on error. Description: Call this to get the status of the upload specified by 'upload'. Example: api.php?cmd=get_upload_status?cmd=get_upload_status&upload=45c8a24bcb4d0ca156b651a4120575bb&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=get_new_long_ses Parameter: ses= long_ses= Returns: new value of 'long_ses' on success. 'ERROR: ' on error. Description: Used to reset 'long_ses' to a new value. 'ses' and 'long_ses' must be provided. Example: request: api.php?cmd=get_new_long_ses&ses=24bcb4d0caa4120575bb45c8a156b651&long_ses=5f03faa873f97bcda89a51ec239dda666f3e72526f4e7f121742fd764fce9799942760417eeaa832c81fdd220261af158377de6adec1e6ca704d8322c4ec02aa reply: 38df4a3719b9c55b870913fd572ef8391d97c48963da8dd9034b624f31d5cb842008c0de1995fe6013bf6a6f818dd7a6482af1c5a869e5046769ed00d6117129 ================================================================================ cmd=logout Parameter: ses= Returns: 'TRUE' on success, 'ERROR: ' on error. Description: Use this logout function to destroy a 'ses'. 'long_ses' cannot be logged out. Cookies for 'ses' and 'long_ses' gets deleted but 'long_ses' remains valid. If you need to logout a 'long_ses' use the command 'get_new_long_ses' first and discard the result. Example: api.php?cmd=logout&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=get_supported_och_dl Parameter: ses= or long_ses= Returns: List of supported OCH for download. Delimiter: , '0' if no hoster is currently available. 'ERROR: ' on error. Description: Call this to get a list of the supported one click hoster that are currently available for download. Example: api.php?cmd=get_supported_och_dl&ses=24bcb4d0caa4120575bb45c8a156b651 ================================================================================ cmd=check_remote_file Parameter: ses= or long_ses= url= Returns: 'OK,, 'ERROR: ' on error. Description: This call checks if the remote file given by url is valid for upload. Note that url is NOT urlencoded and therefore needs to be the last parameter. Example: api.php?cmd=check_remote_file&ses=24bcb4d0caa4120575bb45c8a156b651&url=http://example.com/file.data ================================================================================ End of file