Main | Documentation | Demo | Sample PHP

Documentation

Prerequisites

In order to use our API, you will need to get an access-code which you should send along with every api request (see Main Page for more information). You can get an api key by simply logging in, and you will see it appear automatically below (if you return here), and in the api key box on the API Demo page. You will then see your generated api code, which you should use to authorise yourself against our system, whenever making requests.

API Requests

Link Generation

In order to generate links, you should send a POST OR GET request to http://api.rapidgen.net/api/. Only send ONE type request; if you send POST, the url should ONLY be 'http://api.rapidgen.net/api/'!). The following postdata is expected:

For a demonstration, you can use the following API key: BKAy7UlBOhT92oFFC5r9YYsMMFTOqR @ the API Demo

API Link Generation Example

<REQUEST> (using POST)
POST /api/ HTTP/1.1
Host: api.rapidgen.net
User-Agent: Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate*
Accept-Charset: UTF-8,*
Content-Type: application/x-www-form-urlencoded
Content-Length: 447
sub=linkgen&links=http%3A%2F%2Ffilehost.com%2Fdl%2F43686851%2Fd2bc528%2FCash.2008.x264.utkuemre.part1.rar.html+%0D%0Ahttp%3A%2F%2Ffilehost.com%2Fdl%2F43686914%2F89b6b78%2FCash.2008.x264.utkuemre.part2.rar.html+%0D%0Ahttp%3A%2F%2Ffilehost.com%2Fdl%2F43686954%2F17b2bb0%2FCash.2008.x264.utkuemre.part3.rar.html+%0D%0Ahttp%3A%2F%2Ffilehost.com%2Fdl%2F43686969%2F8ac988b%2FCash.2008.x264.utkuemre.part4.rar.html&api_key=BKAy7UlBOhT92oFFC5r9YYsMMFTOqR
<RESPONSE>
HTTP/1.1 200 OK
Date: Sat, 15 Jan 2011 21:18:13 GMT
Server: Apache
Vary: Host,Accept-Encoding
X-Powered-By: PHP
Cache-Control: no-cache, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Content-Length: 356
Content-Type: application/json; charset=UTF-8

{"status":"OK","data":[{"service":"filehost","sid":"alcva","filename":"video.x264.part1.rar"},{"service":"filehost","sid":"AApCR","filename":"video.x264.part2.rar"},{"service":"filehost","sid":"SG6E1","filename":"video.x264.part3.rar"},{"service":"filehost","sid":"hu4Ue","filename":"video.x264.part4.rar"}]}

You could also have made the request directly via the url:

<REQUEST> (using GET)
http://api.rapidgen.net/api/?sub=linkgen&links=http://filehost.com/file/43686851/d2bc528/video.x264.part1.rar.html,http://filehost.com/file/43686914/89b6b78/video.x264.part2.rar.html,http://filehost.com/file/43686954/17b2bb0/video.x264.part3.rar.html,http://filehost.com/file/43686969/8ac988b/video.x264.part4.rar.html&api_key=BKAy7UlBOhT92oFFC5r9YYsMMFTOqR

*If you send this header in the <REQUEST>, you will receive a gzipped response from us. The header is optional, so if you exclude it, you will get a normal unzipped response.

Subroutine List

You can pass several parameters to the /api/ uri to get back a result. You can either use POST, or GET — simply by passing the parameters in the full url appended with & as follows:
http://api.rapidgen.net/api/?api_key=api_key&sub=sub

Notice the appendage of /api/ to the query, followed by your parameters. The parameter api_key must always be passed if you want a result set based on your own files. (Parameters which do not require the api_key parameter may be added later.)

The subroutine sub will be one of the following:

getlinklist_all

Returns a json-encoded list of all your stored links.

getlinklist_active

Returns a json-encoded list of all your active stored links. Inactive (expired) links will not be returned in the list.

getlinklist_inactive

Returns a json-encoded list of all your expired stored links. Active (downloadable) links will not be returned in the list.

getbw_used

Parameter(s) required:

Returns json-encoded data of your used bandwidth for a given filehost

getbw_remain

Parameter(s) required:

Returns json-encoded data of your remaining bandwidth for a given filehost

Parameters List

Parameters are not always required. You only need to use them if they are required by one of the subroutines above. The method for passing the parameters is the same as the subroutines; passed directly via the url, i.e. &filehost=<filehost> or along with other parameters in a POST request.

The subroutine sub could be one of the following:

filehost

The name for the particular filehost you want to find statistics for. The filehost name should be in all lower case letters. See the statistics table at the bottom of any page of http://rapidgen.net for a list of the filehost names (called 'Service*'). Example: &filehost=megaupload

API Error Codes

Here's a quick list of some of the error codes you're likely to get back from the API. You're only going to get an error code in the event of an error, not when you get a valid response back.