s.hort.cc makes s.hort.cuts

Yet Another Short URL.

I just launched s.hort.cc to offer something that TinyURL and Tiny.cc didn’t: an easy API for creating short URLs, or “s.hort.cuts,” and returning them in a format my program could use.

You can visit the s.hort.cc website, of course, but you can also create a short URL and have it returned to you in XML, JSON, YAML, or plain text. (Even if you decide to parse the whole XHTML page, it’s easy to find the s.hort.cut with the DOM or an XPath parser.) I’ll gladly add other formats if people suggest them.

I’m working on a Firefox extension, but in the meantime, drag this link: [s.hort.cut](javascript:void(window.open('http://s.hort.cc/create.php?url='+escape(window.location), 'shortcut', 'status=0,toolbar=0,location=0,menubar=0,scrollbars=0,height=320,width=400')); "s.hort.cut") to your bookmarks toolbar to automagically turn the current page into a s.hort.cut.

Read more technical info below the break.

Technical Things!

To use the API, you just need to send a request to http://s.hort.cc/create.php, via GET or POST, with two parameters:

  • url — contains the URL-escaped long URL you want to shrink, and
  • format — one of “json“, “xml“, “yaml“, or “text” or “plain“, depending on what you need.

s.hort.cc returns the new URL in the correct format and with the correct Content-type heading. (For JSON, the content is available both in the response body and in the X-JSON header.)

If possible, please try to set a unique and meaningful User-Agent header, just so I can track usage, and so your app won’t be subject to rate limiting because of someone else’s problem.

Not that there is rate limiting. You can use the API as much as you want. But if you’re going to access it more than 60 times per minute, or once per second on average, please let me know.

On the server-side, s.hort.cc is written in PHP and backed by MySQL and Memcached to speed up requests and reduce server load.