Feb 26, 2009

Domain Name Registration API Plugin for Rails

If you’ve ever had an app where you want to allow users to purchase a domain name, you’ve probably felt the pain of trying to interface to a registrar.  Although some have APIs, my search found that most were hard to interface to or poorly documented.  Many even required signing up as a partner (and paying a big fee) before you could even get documenation.

After much searching and experimenting I decided to go with Register.com’s XML api for my app. They offered the best API, and the easiest signup path.

I bundled the main part of the interface into a rails plugin.  The plugin is stored on github: http://github.com/geoffevason/register-api/tree/master

To install the plugin do this:


script/plugin install git://github.com/geoffevason/register-api.git

The plugin is of little value unless you have spoken to register.com and have received their API documentation. You need to register as a partner (it’s free) and have the IP of your dev machine whitelisted for testing.

Most of the info on use is in the readme in the plugin. You can call any of the Register.com API methods by calling Register::API.


# A call to the API looks like this
# Register::Api::Call(params)

# Example to check if the domain name google.com is available
Register::Api::Check(:tld => 'com', :sld => 'google')

The plugin also contains a few helper methods and classes. If all you want to do is let people search for an available domain, and purchase it, then everything you need is in these helpers. Some important logic remains in my controllers, but if you have any questions, let me know.