<< Back

Fun.ly API Documentation

Features

  • Generate or get existing short URLs, with sequential or custom keyword
  • Get some statistics about your links: top clicked links, least clicked links, newest links
  • Output format: JSON, XML, or simple raw text
  • Authentify either with login/password or using a secure passwordless mechanism

Usage

You need to send parameters to http://fun.ly/yourls-api.php either via GET or POST. These parameters are:

  • A valid username / password pair, (Default username/password for Fun.ly is admin/123abc)
  • The requested action: "shorturl" (get short URL for a link), "expand" (get long URL of a shorturl), "url-stats" (get stats about one short URL) or "stats" (get stats about your links)
  • With action = "shorturl" :
    • the url to shorten
    • optional usercode Your Funly Cash Usercode (If you want to create a Fun.ly Cash URL)
    • optional keyword for custom short URLs
    • output format: either "json", "xml" or "simple"

Sample return

<result>
	<url>
		<id>62019439011</id>
		<keyword>shorter</keyword>
		<url>http://somereallylongurlyouneedtoshrink.com/</url>
		<date>2009-06-23 18:08:07</date>
		<ip>127.0.0.1</ip>
	</url>
	<status>success</status>
	<message>http://somereallylongurlyouneedtoshrink.com/ (ID: shorter) added to database</message>
	<shorturl>http://fun.ly/shorter</shorturl>
</result>

Sample file

There's a sample file included that serves as an example on how to play with the API

Python Example

ksaver over at SNIPPLR has been kind enough to provide everyone with a python example, FUN.PY: SHORT A URL FROM COMMAND LINE, USING FUN.LY SERVICE