Stathers.net

Transferring Domain to Gandi.net

14 May 2014

I recently decided to transfer my domain away from my original registrar, Netfirms.ca to Gandi.net.

This all came about as part of a solution I had devised to provide myself with some sort of DIY dynamic DNS. Netfirms didn’t really have any way for me to update my DNS records programmatically. On the recommendation of a friend, I looked into Gandi and discovered that they had a fully-featured API which would allow me to solve my dynamic DNS problem!

I have begun fleshing out a Perl script which I will use to make the appropriate API calls back to Gandi. I will most likely use this as a cron job back on one of my home machines. I have designed the script to be as multipurpose as possible in case other people want to use the script to update their own records:

./update_gandi_dns.pl <-h hostname> <-d domain> <-i ipv4_address>

I am finding their API quite easy to use so far, and I only need the CPAN XML::RPC library for my Perl script. Here is a little sample of how simple it is to setup a new object and start making API calls:

use XML::RPC;

my $api = XML::RPC->new('https://rpc.gandi.net/xmlrpc/');

my $apikey = 'my 24-character API key';

# Now you can call API methods.
# You must authenticate yourself by passing the API key
# as the first method's argument
my $version = $api->call( 'version.info', $apikey );

That is just a version.info API call, but most of their methods take similar arguments which I find to be relatively intuitive:

For a reference of API calls, please see: http://doc.rpc.gandi.net/

At the time of writing, the script is not yet finished but I will be sure to post an update back once it is functional. In the meantime, please feel free to take a look at my progress or The script is now complete, please fork at will: https://github.com/mstathers/update-gandi-dns

Oh, one other noteworthy thing about Gandi, their slogan is “No Bullshit” - I think we all can appreciate that!


Update (2014-05-21): My script is now functional! After my domain fully transferred to Gandi, I was able to finish off work on the API calls. I ran into a few snags on the way which I thought I would mention in case anybody else runs into these problems. If you use their web interface for managing your domain zones you will know that you cannot edit your current zone. Instead, you must first clone your zone, make changes to the cloned zone and then set your cloned zone as the current version. This is some sort of rudimentary version control system and I can understand why they decided to do this. It wasn’t immediately apparent to me, and I couldn’t find it in the documentation, but you must follow this same procedure with the API.

« Website Relaunch - Now with more Jekyll Project - Video List Website »