API Documentation
General informations
- http://twi.mn/api.json for JSON responses
- http://twi.mn/api.xml for XML responses
URL-shortening API
Shorten URL
Use : http://twi.mn/api.json / http://twi.mn/api.xml
The API automatically detects if you're sending a Twi.mn URL and if not, send you the shorten URL back.
Params :
- url (string) : the URL you want to shorten - required -
Returns :
- error (int) : 0 if no error or error code (see below)
- url (string) : the shortened URL (i.e. http://twi.mn/a)
Expand URL
Use : http://twi.mn/api.json / http://twi.mn/api.xml
The API automatically detects if you're sending a Twi.mn URL and if yes, send you the long URL back.
Params :
- url (string) : the URL you want to expand - required -
Returns :
- error (int) : 0 if no error or error code (see below)
- url (string) : the original URL (i.e. http://www.google.fr/search?hl=fr&site=&q=benjamin+anseaume&btnG=Rechercher&meta= )
Long-Post API
Use : http://twi.mn/api.json / http://twi.mn/api.xml
Params :
- twimn (string) : the long message with HTML tags - required -
- twitter_account (string) : the username of the author (or application name if do_post is FALSE) - required -
- twitter_password (string) : the twitter password of the author - required if do_post is TRUE -
- do_post (boolean) : TRUE if you want to post directly the tweet. If not, you get the tweet formated and can post from your own application. - optional -
- in_reply_to_status_id (int) : if the tweet is a reply - optional -
Returns :
- error (int) : 0 if no error or error code (see below)
- url (string) : the Twi.mn URL (i.e. http://twi.mn/a )
- tweet (string) : the tweet ready to post (or posted if posted is TRUE)
- posted (boolean) : tweet posted or not (because of an error, and depending on doPost)
Note :
When not posting, the username can be either the application name or the user name. Sending a false name is prohibited and as a consequence your application can be blacklisted.
Errors list
Error are returned if something went wrong. Only 1 error is returned.
You get a number, see below for corresponding state, and a detailled message in the 'message' parameter.
- 1000 : the method you're trying to use does not exist.
- 1001 : the URL you're trying to expand does not exist in our database.
- 1002 : the URL you sent is not a short URL, but another media type (i.e. picture, or long-tweet)
- 1003 : we can not record your URL because it is not a valid URL, or because the server is blacklisted or another URL-shortening service
- 1004 : one required argument at less is missing
