RAAK.it API documentation
7 October 2010
11:39
2 comments
Tweet
Here are the calls in the raak.it URL shortener API:
The API is a RESTful API, ie each call is implemented as a URI.
All calls return JSON strings as output.
register.php
http://raak.it/register.php?url=your url
your url: The URL you want to shorten.
output:
-
code
: 0 on success, a negative value on error, translating to:-1
: No URL was entered-2
: URL could not be resolved-3
: URL returned an error-4
: Cannot connect to the database-5
: Cannot select the database-6
: Cannot query the database-7
: URL was stored before, but it can not be fetched-8
: URL was not stored before, and it can not be entered into the database-9
: URL’s page title could not be updated
result
: only on success, the short URL that will redirect to the given URLerror
: only on error, a message describing the errorhttp_code
: only on error code -2, the HTTP code returnedmysql_error
: only on error codes -4 to -9, a message describing the database error
retrieve.php
http://raak.it/retrieve.php?shorturl=short url
short url: The short URL whose long URL you want to retrieve.
output:
-
code
: 0 on success, a negative value on error, translating to:-1
: No short URL was entered-4
: Cannot connect to the database-5
: Cannot select the database-6
: Cannot query the database-8
: Cannot update this retrieval stat (still returns URL)-9
: URL can not be found
result
: only on success, or error code -8, the long URL that will be redirected to by the given short URLerror
: only on error, a message describing the errormysql_error
: only on error codes -4 to -8, a message describing the database error
stats.php
http://raak.it/stats.php?[url=long url][shorturl=short url
]
long url (optional): The long URL whose stats you want to retrieve.
short url (optional): The short URL whose stats you want to retrieve.
default (no args): Basic stats (no ip addresses) for all URLs.
output:
-
code
: 0 on success, a negative value on error, translating to:-1
: No short URL was entered-4
: Cannot connect to the database-5
: Cannot select the database-6
: Cannot query the database-9
: URL can not be found
-
urls
: a list of URL stats-
url hash
: The hash part of the short url, acts as a keyurl
: The long URLtitle
: The page title of the URLcount
: The amount of hits on the URLips
: (only when shorturl or url have been provided) A list of IP address that visited this URL
-
error
: only on error, a message describing the errormysql_error
: only on error codes -4 to -8, a message describing the database error
Posted by Adriaan Pelzer
Follow @adriaan_pelzer
2 Trackbacks
[...] We’ve implemented this idea as a URL shortener here, with an API, which is documented here. [...]
[...] you ever wonder exactly how URL shorteners work? So did we, so we built one (with an API). This week's tech insight explores the problem of mapping long URLs into short ones, and the [...]
Leave a Comment