The ttb.li API consists of 4 parts: URL-shortener, URL-expander, File Sharer (beta) and Media preview (beta - for previewing shared pictures).

 

URL Shortener

WIth the ttb.li URL shortener API, you can create shortened URLs. This API doesn't require a API key or login credentials. API access is unlimited, but in case of heavily abuse, we will disable your API access.

Usage

http://ttb.li/api/shorten?url=[[yourLongURL]]&appname=[[AppName]]&format=[[ResponseFormat]]

Parameters

  • url: URL to shorten, should be URL-encoded. Required.
  • appname: unique string to indentify the app that's using the API, not required, but recommended for future API functions, like analytics.
  • format: format of API response. Possible values: xml, json, plain. Optional, default value: plain.

 

Example succes response in XML
http://ttb.li/api/shorten?url=http%3A%2F%2Fwww.tomttb.com&appname=DocTest&format=xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<output>
    <shorturl>http://ttb.li/s9kcl</shorturl>
</output>

Example succes response in JSON
http://ttb.li/api/shorten?url=http%3A%2F%2Fwww.tomttb.com&appname=DocTest&format=json

{ 
    "shorturl": "http://ttb.li/s9kcl" 
}

Example succes response in plain text
http://ttb.li/api/shorten?url=http%3A%2F%2Fwww.tomttb.com&appname=DocTest&format=plain

http://ttb.li/s9kcl

Example error response in JSON
http://ttb.li/api/shorten?url=http://&appname=DocTest&format=json

{ 
    "error": "Please specify a valid URL to shorten." 
}

 


URL Extender

With the ttb.li URL extender API, you can find the original URL of a ttb.li short-url. This API doesn't require a API key or login credentials. API access is unlimited, but in case of heavily abuse, we will disable your API access.

Usage

http://ttb.li/api/extend?url=[[ttbliShortURL]]&appname=[[AppName]]&format=[[ResponseFormat]]

Parameters

  • url: ttb.li URL to extend. Required.
  • appname: unique string to indentify the app that's using the API, not required, but recommended for future API functions, like analytics.
  • format: format of API response. Possible values: xml, json, plain. Optional, default value: plain.

 

Example succes response in XML
http://ttb.li/api/extend?url=http%3A%2F%2Fttb.li/s9kcl&appname=DocTest&format=xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<output>
    <longurl>http://www.tomttb.com</longurl>
</output>

Example succes response in JSON
http://ttb.li/api/extend?url=http%3A%2F%2Fttb.li/s9kcl&appname=DocTest&format=json

{ 
    "longurl": "http://www.tomttb.com" 
}

Example succes response in plain text
http://ttb.li/api/extend?url=http%3A%2F%2Fttb.li/s9kcl&appname=DocTest&format=plain

http://www.tomttb.com

Example error response in JSON
http://ttb.li/api/extend?url=http://&appname=DocTest&format=json

{ 
    "error": "Please specify a valid ttb.li short-url to extend." 
}

 


File Sharer (beta)

WIth the ttb.li File Sharer API, you can share files via a ttb.li short-url. This API doesn't require a API key or login credentials. API access is unlimited, but in case of heavily abuse, we will disable your API access.

Not publicly available yet.

 


Media Preview (beta)

With the ttb.li Media Preview API, you can get previews of photos shared via ttb.li. This API doesn't require a API key or login credentials. API access is unlimited, but in case of heavily abuse, we will disable your API access.

Not publicly available yet.