The new RubyURL API
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. :-)
Enjoying the content? Be sure to subscribe to my RSS feed.




xml? really?
James,
I’m hoping to get some time to update the API and provide JSON support soon. Volunteers are welcome to further that cause. ;-)
Yes! JSON support would be fantastic!
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?
@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.
I am impresed! :)
Hi Robby. All clear now, thanks ;-)
Very nice!