Read my latest article: Lesson Learned: Git Ref Naming (posted Fri, 19 Sep 2008 04:23:00 GMT)

The new RubyURL API

Posted by Robby Russell Sun, 31 Aug 2008 18:55:00 GMT

8 comments Latest by Korepetycje Sun, 07 Sep 2008 14:01:20 GMT

We’ve just deployed the initial version of an API for RubyURL. It makes it really easy to create RubyURLs and is now open to the public. Should it end up being abused, we’ll consider introducing an API KEY for authenticating and tracking abuse.

In the meantime, you can now start to use the RubyURL API.

For example, the following…


$ curl  -i \ 
        -X POST \
        -H 'Content-Type: application/xml' \
        -d '<link><website_url>http://github.com/robbyrussell</website_url></link>' \
        http://rubyurl.com/api/links  


	

...would return the following response.

I’ll be updating the ShortURL gem in the coming days (unless someone else wants to patch it first wink) to take advantage of new API, versus how it’s currently creating RubyURLs.

You can see the code & changes for this new API on the RubyURL github site.

Update with JSON

I took a little time today to update the API and extend it to support JSON. So… you can now use the RubyURL API to generate RubyURLs via JSON. (see commits)

Enjoy! If you’re using RubyURL via the new API, I’d love to hear about it. :-)

Subscribe to my RSS feed Enjoying the content? Be sure to subscribe to my RSS feed.
Comments

Leave a response

  1. Avatar
    James Cox Sun, 31 Aug 2008 19:05:51 GMT

    xml? really?

  2. Avatar
    Robby Russell Sun, 31 Aug 2008 19:39:14 GMT Recommend me on Working with Rails

    James,

    I’m hoping to get some time to update the API and provide JSON support soon. Volunteers are welcome to further that cause. ;-)

  3. Avatar
    Ray Sun, 31 Aug 2008 20:24:12 GMT

    Yes! JSON support would be fantastic!

  4. Avatar
    Matt Mower Mon, 01 Sep 2008 14:44:09 GMT

    Maybe I missed something but, since you’re passing it in with the request, why do you need to return the website URL?

    If you don’t then couldn’t you ditch XML and JSON and return an appropriate HTTP status code & Location: header?

  5. Avatar
    Robby Russell Mon, 01 Sep 2008 16:19:03 GMT Recommend me on Working with Rails

    @Matt,

    I’m not trying to provide a redirect with this, just aiming to provide people with a short url to use wherever. RubyURL itself does the redirect… the API just provides a non-web browser interface to generating RubyURLs.

  6. Avatar
    kod pocztowy Tue, 02 Sep 2008 08:01:50 GMT

    I am impresed! :)

  7. Avatar
    Matt Mower Wed, 03 Sep 2008 08:33:37 GMT

    Hi Robby. All clear now, thanks ;-)

  8. Avatar
    Korepetycje Sun, 07 Sep 2008 14:01:20 GMT

    Very nice!

Share your thoughts... (really...I want to hear them)

Comments