Gandi XML-RPC API specification

Documents version: 1.0

Table of contents

Methods

login

Signature
string login(string login, string password [, boolean safe])
Description
Log in to the XML-RPC interface and retrieve a session id.
Warning

Sessions ID are sensitive information and therefore must be kept secret. If a session ID was to be disclosed a malicious user would be able to execute commands with your credentials during 12 hours.

Parameters
Optional parameter
Returns
The XML-RPC response will contain a session id (string) if the login procedure is successful or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python) - logging in with safe mode
import sys 
import xmlrpclib
proxy = xmlrpclib.ServerProxy("https://api.gandi.net/xmlrpc/")
try:
	session = proxy.login("AA1234-GANDI", "mypassword", True)
except xmlrpclib.Fault, e:
	print "could not login because: " + e.faultString
	sys.exit(67)
	
Sample code (php) - logging in with safe mode
<?php
require_once("xmlrpc.inc");

$proxy = new xmlrpc_client("https://api.gandi.net/xmlrpc/");
$msg = new xmlrpcmsg(
        "login",
        array(new xmlrpcval("AA1234-GANDI"),
        new xmlrpcval("mypassword"),
        new xmlrpcval(True, "boolean"))
);
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
        echo "could not login because: " . $reply->faultString() . "\n";
        exit(67);
}
$session = $reply->value();
?>
	
Sample code (perl) - logging in with safe mode
my $safe_mode = XMLRPC::Data->type('boolean')->value(1);
my $proxy = XMLRPC::Lite->proxy("https://api.gandi.net/xmlrpc/");
my $reply = $proxy->call("login", "AA1234-GANDI", "mypassword", $safe_mode);
my $session = $reply->result();
die "could not login because: " . $reply->faultstring . "\n" unless defined $session;
	

su

Signature
string su(string session, string handle)
Description
Temporarily limit your rights to the rights of user "handle". cf. safe mode.
Warning

Sessions ID are sensitive information and therefore must be kept secret. If a session ID was to be disclosed a malicious user would be able to execute commands with your credentials during 12 hours.

Parameters
Returns
The XML-RPC response will contain a new session id (string) if the "su" is successful or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
try:
	session = proxy.su(session, "AA4321-GANDI")
except xmlrpclib.Fault, e:
	print "could not su to user AA4321-GANDI because: " + e.faultString
	sys.exit(67)
	
Sample code (php)
<?php
$msg = new xmlrpcmsg(
        "su",
        array($session, new xmlrpcval("AA4321-GANDI"))
);
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
        echo "could not su to user AA4321-GANDI because: " . $reply->faultString() . "\n";
        exit(67);
}
$session = $reply->value();
?>
	
Sample code (perl)
my $reply = $proxy->call("su", $session, "AA4321-GANDI");
my $session = $reply->result();
die "could not su to user AA4321-GANDI because: " . $reply->faultstring . "\n" unless defined $session;
	

password

Signature
boolean password(string session, string password)
Description
Change the XML-RPC API password of the account used during the login procedure.
Parameters
Returns
The XML-RPC response will return True if the "password" method is successful or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
try:
	proxy.password(session, "mynewpassword")
except xmlrpclib.Fault, e:
	print "could not change the password because: " + e.faultString
	sys.exit(67)
	
Sample code (php)
<?php
$msg = new xmlrpcmsg(
        "password",
        array($session, new xmlrpcval("mynewpassword"))
);
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
        echo "could not change the password because: " . $reply->faultString() . "\n";
        exit(67);
}
?>
	
Sample code (perl)
my $reply = $proxy->call("password", $session, "mynewpassword");
my $result = $reply->result();
die "could not change the password because: " . $reply->faultstring . "\n" unless defined $result;
	

account_currency

Signature
string account_currency(string session)
Description
Retrieve the currency name used with this prepaid account.
Parameters
Returns
The XML-RPC response will contain the ISO 4217 currency name (string) used for this account.
Possible faults are described in section Error Codes Format.
Sample code (python)
print "prepaid account currency: %s" % proxy.account_currency(session)
	
Sample code (php)
$msg = new xmlrpcmsg("account_currency", array($session));
$reply = $proxy->send($msg);
$val = $reply->value();
$val = $val->scalarval();
print "prepaid account currency: " . $val . "\n";
	
Sample code (perl)
my $reply = $proxy->call("account_currency", $session);
my $currency = $reply->result();
print "prepaid account currency: " . $currency . "\n";
	

account_balance

Signature
double account_balance(string session)
Description
Retrieve the prepaid account balance.
Parameters
Returns
The XML-RPC response will contain the balance of the account (double).
Possible faults are described in section Error Codes Format.
Sample code (python)
print "prepaid account balance: %d"  % proxy.account_balance(session)
	
Sample code (php)
$msg = new xmlrpcmsg("account_balance", array($session));
$reply = $proxy->send($msg);
$val = $reply->value();
$val = $val->scalarval();
print "prepaid account currency: " . $val . "\n";
	
Sample code (perl)
my $reply = $proxy->call("account_balance", $session);
my $balance = $reply->result();
print "prepaid account balance: " . $balance . "\n";
	

domain_list

Signature
array domain_list(string session)
Description
Returns an array of domains for which the logged user is the reseller or a contact (owner, administrative, billing or technical).
Parameters
Returns
The XML-RPC response will contain an array of domains (string) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
try:
	domains = proxy.domain_list(session)
	print "domains:"
	pprint.pprint(domains)
except xmlrpclib.Fault, e:
	print "could not retrieve the list of domains because: %s" % e.faultString
	
Sample code (php)
$msg = new xmlrpcmsg("domain_list", array($session));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not retrieve the list of domains because: %s\n", $reply->faultString()); 
}
else {  
	$val = php_xmlrpc_decode($reply->value());
	print_r($val);
}
	
Sample code (perl)
my $reply = $proxy->call("domain_list", $session);
my $domains = $reply->result();
unless (defined $domains) {
	print "could not retrieve the list of domains because: " . $reply->faultstring . "\n";
}
else {
	print Dumper($domains);
}
	

domain_available

Signature
struct domain_available(string session, array domains)
Description
Check a domain availability.
Parameters
Returns
The XML-RPC response will contain the availability (struct) of the domains or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
domains = ["example.net", "example.org", "example.com"]
try:
	availability = proxy.domain_available(session, domains)
	print "available domains:"
	pprint.pprint(availability)
except xmlrpclib.Fault, e:
	print "could not check for availability because: %s" % e.faultString
	
Sample code (php)
$domains = array(
	new xmlrpcval("example.net"),
	new xmlrpcval("example.org"),
	new xmlrpcval("example.com")
);
$msg = new xmlrpcmsg("domain_available", array($session, new xmlrpcval($domains, "array")));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not check for availability because: %s\n", $reply->faultString()); 
}
else {  
	$val = $reply->value();
	$val->structreset();
	print "available domains:\n";
	while (list($key, $value) = $val->structeach()) {
		printf("%s : %s\n", $key, $value->scalarval() ? "True" : "False");
	}
}
	
Sample code (perl)
my $domains = ["example.net", "example.org", "example.com"];
my $reply = $proxy->call("domain_available", $session, $domains);
my $availability = $reply->result();
unless (defined $availability) {
	print "could not check for availability because: " . $reply->faultstring . "\n";
}
else {
	while (($domain, $available) = each (%$availability)) {
		print $domain . " : " . ($available ? "True" : "False") . "\n";
	}
}
	

domain_lock

Signature
int domain_lock(string session, string domain)
Description
Add a lock status (cf. domain_info) to avoid any fraudulent transfer.
Availability
Any domains except those ending with .FR, .EU or .BE.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
try:
	opid = proxy.domain_lock(session, domain)
	print "locking of domain '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not lock domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_lock", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not lock domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("locking of domain '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_lock", $session, $domain);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not lock domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "locking of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_unlock

Signature
int domain_unlock(string session, string domain)
Description
Remove a lock status (cf. domain_info) to transfer the domain to another registrar.
Availability
Any domains except those ending with .FR, .EU or .BE.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
try:
	opid = proxy.domain_unlock(session, domain)
	print "unlocking of domain '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not unlock domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_unlock", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not unlock domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("unlocking of domain '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_unlock", $session, $domain);
my $opid = $reply->result();
unless (defined $opid) {
   printf "could not unlock domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
   printf "unlocking of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_info

Signature
struct domain_info(string session, string domain)
Description
Retrieve the informations linked to this domain (contacts, nameservers, redirections, weblogs...). This method only works on domains handled by Gandi.
Parameters
Returns
The XML-RPC response will contain the informations (struct) associated with the specified domain or a fault describing the problem.
The returned struct contains the following keys:
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
domain = "example.net"
try:
	info = proxy.domain_info(session, domain)
	pprint.pprint(info)
except xmlrpclib.Fault, e:
	print "could not get information for domain '%s': %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_info", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not get information for domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = php_xmlrpc_decode($reply->value());
	print_r($val);
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_info", $session, $domain);
my $info = $reply->result();
unless (defined $opid) {
	printf "could not get information for domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	print Dumper($info);
}
	

domain_renew

Signature
int domain_renew(string session, string domain, int period)
Description
Renew a domain for a number of years.
Availability
The total number of years cannot exceed 10.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
try:
	opid = proxy.domain_renew(session, domain, 4)
	print "renewal of '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not renew domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_renew", array($session, new xmlrpcval($domain), new xmlrpcval(4, "int")));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not renew domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("renewal of '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_renew", $session, $domain, 4);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not renew domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "renewal of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_create

Signature
int domain_create(string session, string domain, int period, string owner_handle, string admin_handle, string tech_handle, string billing_handle, array nameservers [, string lang])
Description
Register a domain with gandi and associate it to a list of contacts.
Parameters
Optional parameter
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.org"
period = 1
owner_handle = "AA1234-GANDI"
admin_handle = "BB2345-GANDI"
tech_handle = "CC3456-GANDI"
billing_handle = "DD4567-GANDI"
ns_list = ["ns1.example.net", "ns2.example.net", "ns1.example.com"]
try:
	opid = proxy.domain_create(session, domain, period, owner_handle, admin_handle, tech_handle, billing_handle, ns_list)
	print "creation of domain '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not create domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.org";
$period = new xmlrpcval(1, "int");
$owner_handle = new xmlrpcval("AA1234-GANDI");
$admin_handle = new xmlrpcval("AA1234-GANDI");
$tech_handle = new xmlrpcval("CC3456-GANDI");
$billing_handle = new xmlrpcval("DD4567-GANDI");
$nameservers = php_xmlrpc_encode(array("ns1.example.net", "ns2.example.net", "ns1.example.com"));
$msg = new xmlrpcmsg("domain_create",
	array($session, new xmlrpcval($domain),
		$period, $owner_handle,
		$admin_handle, $tech_handle,
		$billing_handle, $nameservers
	)
);
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not create domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("creation of domain '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.org";
my $period = 1;
my $owner_handle = "AA1234-GANDI";
my $admin_handle = "AA1234-GANDI";
my $tech_handle = "CC3456-GANDI";
my $billing_handle = "DD4567-GANDI";
my $nameservers = ["ns1.example.net", "ns2.example.net", "ns1.example.com"]

my $reply = $proxy->call("domain_create", $session, $domain, $period, $owner_handle, $admin_handle, $tech_handle, $billing_handle, $nameservers);

my $opid = $reply->result();
unless (defined $opid) {
	printf "could not create domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "creation of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_restore

Signature
int domain_restore(string session, string domain)
Description
Get a domain out of its redemption period. See glossary, Restore.
Availability
This function is available for domains in .COM, .NET, .BE or .EU.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
try:
	opid = proxy.domain_restore(session, domain)
	print "restoration domain '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not restore domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_restore", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not restore domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("restoration of '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_restore", $session, $domain);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not restore domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "restoration of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_del

Signature
int domain_del(string session, string domain)
Description
Delete a domain.
Availability

This function will be available in v1.10

Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.com"
try:
	opid = proxy.domain_del(session, domain)
	print "deletion of '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not delete domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.com";
$msg = new xmlrpcmsg("domain_del", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not delete domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("deletion of '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.com";
my $reply = $proxy->call("domain_delete", $session, $domain);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not delete domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "deletion of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_transfer_in_available

Signature
boolean domain_transfer_in_available(string session, string domain)
Description
Check if a domain can be transfered from another registrar. See glossary, Transfer.
Parameters
Returns
The XML-RPC response will contain this operation feasibility (boolean) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
try:
	result = proxy.domain_transfer_in_available(session, domain)
	print "could the domain '%s' be transfered to Gandi: %s" % (domain, result)
except xmlrpclib.Fault, e:
	print "could not check for the transfer feasibility of the domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_transfer_in_available", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not check for the transfer feasibility of the domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("could the domain '%s' be transfered to Gandi: %s\n", $domain, $val ? "True" : "False");
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_transfer_in_available", $session, $domain);
my $val = $reply->result();
unless (defined $opid) {
	printf "could not check for the transfer feasibility of the domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "could the domain '%s' be transfered to Gandi: %s\n", $domain, $val ? "True" : "False";
}
	

domain_transfer_in

Signature
int domain_transfer_in(string session, string domain, string owner_handle, string admin_handle, string tech_handle, string billing_handle, array nameservers [, string auth_code])
Description
Transfer (see glossary, Transfer) a domain from another registrar to Gandi, or from a Gandi account to a Gandi reseller. If the domain is already at Gandi (internal transfer), owner_handle, admin_handle, tech_handle and billing_handle are maintained.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
ns_list = ["ns1.example.net", "ns2.example.net", "ns1.example.com"]
try:
	opid = proxy.domain_transfer_in(session, "example.net", "AA1234-GANDI", "BB2345-GANDI", "BB2345-GANDI", "BB2345-GANDI", ns_list, "G0R7Y568B740DK27")
	print "transfer of '%s' to Gandi is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not transfer domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$auth_code = new xmlrpcval("G0R7Y568B740DK27");
$owner_handle = new xmlrpcval("AA1234-GANDI");
$admin_handle = new xmlrpcval("BB2345-GANDI");
$tech_handle = new xmlrpcval("BB2345-GANDI");
$billing_handle = new xmlrpcval("BB2345-GANDI");
$nameservers = php_xmlrpc_encode(array("ns1.example.net", "ns2.example.net", "ns1.example.com"));
$msg = new xmlrpcmsg("domain_transfer_in", array($session, new xmlrpcval($domain), $owner_handle, $admin_handle, $tech_handle, $billing_handle, $nameserver, $auth_code));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not transfer the domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("transfer of '%s' to Gandi is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $auth_code = "G0R7Y568B740DK27";
my $owner_handle = "AA1234-GANDI";
my $admin_handle = "BB2345-GANDI";
my $tech_handle = "BB2345-GANDI";
my $billing_handle = "BB2345-GANDI";
my $nameservers = ["ns1.example.net", "ns2.example.net", "ns1.example.com"]
my $reply = $proxy->call("domain_transfer_in", $session, $domain, $owner_handle, $admin_handle, $tech_handle, $billing_handle, $nameservers, $auth_code);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not transfer the domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "transfer of domain '%s' to Gandi is Gandi operation #%d\n", $domain, $opid;
}
	

domain_transfer_out

Signature
boolean domain_transfer_out(string session, int opid, boolean allow)
Description
Accept or deny a transfer of a domain from Gandi to another registrar. See glossary, Transfer.
Availability

This function will be available in v1.10

Parameters
Returns
The XML-RPC response will contain True (boolean) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample
# opid = 1234, retrieved via operation_list
try:
	proxy.domain_transfer_out(session, opid, True)
except xmlrpclib.Fault, e:
	print "Invalid operation ID: #%d" % opid
	
Sample code (php)
# $opid = new xmlrpcval(1234);
$ack = new xmlrpcval(True, "boolean");
$msg = new xmlrpcmsg("domain_transfer_out", array($session, $opid, $ack));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("Invalid operation ID: #%d\n", $opid->scalarval());
}
	
Sample code (perl)
# my $opid = 1234;
my $reply = $proxy->call("domain_transfer_out", $session, $opid, XMLRPC::Data->type('boolean')->value(1));

my $opid = $reply->result();
unless (defined $opid) {
	printf "Invalid operation ID #%d\n", $opid;
}
	

domain_trade

Signature
int domain_trade(string session, string domain, string owner_handle, string admin_handle, string tech_handle, string billing_handle [, string afnic_titularkey])
Description
Start the trade of a domain from another registrar to Gandi. See glossary, Trade.
Parameters
Optional parameter
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
try:
	opid = proxy.trade(session, "example.net", "AA1234-GANDI", "BB2345-GANDI", "BB2345-GANDI", "BB2345-GANDI")
	print "trade of '%s' to Gandi is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not trade domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$owner_handle = new xmlrpcval("AA1234-GANDI");
$admin_handle = new xmlrpcval("BB2345-GANDI");
$tech_handle = new xmlrpcval("BB2345-GANDI");
$billing_handle = new xmlrpcval("BB2345-GANDI");
$msg = new xmlrpcmsg("domain_trade", array($session, new xmlrpcval($domain), $owner_handle, $admin_handle, $tech_handle, $billing_handle));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not trade the domain '%s' because: %s\n", $domain, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("trade of '%s' to Gandi is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $owner_handle = "AA1234-GANDI";
my $admin_handle = "BB2345-GANDI";
my $tech_handle = "BB2345-GANDI";
my $billing_handle = "BB2345-GANDI";

my $reply = $proxy->call("domain_trade", $session, $domain, $owner_handle, $admin_handle, $tech_handle, $billing_handle);

my $opid = $reply->result();
unless (defined $opid) {
	printf "could not trade domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "trade of '%s' to Gandi is Gandi operation #%d\n", $domain, $opid;
}
	

domain_change_owner

Signature
int domain_change_owner(string session, string domain, string new_owner [, string new_admin, string new_tech, string new_billing])
Description
Change the owner of a domain registered with Gandi and, optionally, the admin, tech and billing contacts. See glossary, Change of Ownership.
Availability

This function will be available in v1.10

Parameters
Optional parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
try:
	opid = proxy.domain_change_owner(session, "example.net", "AA9876-GANDI")
	print "changing owner of domain '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not change the owner of domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$owner = new xmlrpcval("AA9876-GANDI");
$msg = new xmlrpcmsg("domain_change_owner", array($session, new xmlrpcval($domain), $owner));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not change the owner of domain '%s' because: %s\n", $domain, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("changing owner of domain '%s' is Gandi operation #%d\n", $domain, $val)
}  
	
Sample code (perl)
my $domain = "example.net";
my $owner = "AA9876-GANDI";

my $reply = $proxy->call("domain_change_owner", $session, $domain, $owner);

my $opid = $reply->result();
unless (defined $opid) {
	printf "could not change the owner of domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "changing owner of domain '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_change_contact

Signature
int domain_change_contact(string session, string domain, string type, string new_contact)
Description
Change a given contact of a domain registered with Gandi.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
type = "billing"
handle = "BL4444-GANDI"
try:
	opid = proxy.domain_change_contact(session, domain, type, handle)
	print "changing %s contact of domain '%s' to '%s' is Gandi operation #%d" % (type, domain, handle, opid)
except xmlrpclib.Fault, e:
	print "could not change the %s contact of domain '%s' because: %s" % (type, domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$type = "billing";
$handle = "BL4444-GANDI";
$msg = new xmlrpcmsg("domain_change_contact", array($session, new xmlrpcval($domain), new xmlrpcval($type), new xmlrpcval($handle)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not change the %s contact of domain '%s' because: %s\n", $type, $domain, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("changing %s contact of domain '%s' to '%s' is Gandi operation #%d\n", $type, $domain, $handle, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $handle = "BL4444-GANDI";
my $type = "billing"

my $reply = $proxy->call("domain_change_contact", $session, $domain, $type, $handle);

my $opid = $reply->result();
unless (defined $opid) {
	printf "could not change the %s contact of domain '%s' because: %s\n", $type, $domain, $reply->faultstring;
}
else {
	printf "changing %s contact of domain '%s' to '%s' is Gandi operation #%d\n", $type, $domain, $handle, $opid;
}
	

domain_ns_list

Signature
array domain_ns_list(string session, string domain)
Description
Retrieve the name servers list of a domain.
Parameters
Returns
The XML-RPC response will contain an array of name servers (string) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
domain = "example.net"
print "%s:" % domain
try:
	ns_list = proxy.domain_ns_list(session, domain)
	pprint.pprint(ns_list)
except xmlrpclib.Fault, e:
	print "could not retrieve domain '%s' name servers list because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_ns_list", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
printf("%s:\n", domain);
if ($reply->faultCode()) {
   printf("could not retrieve domain '%s' name servers list because: %s\n", $domain, $reply->faultString());
}  
else {
	$val = php_xmlrpc_decode($reply->value());
	print_r($val);
}
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_ns_list", $session, $domain);
printf "%s:\n", $domain;
my $ns_list = $reply->result();
unless (defined $ns_list) {
	printf "could not retrieve domain '%s' name servers list because: %s\n", $domain, $reply->faultstring;
}
else {
	print Dumper($ns_list);
}
	

domain_ns_add

Signature
int domain_ns_add(string session, string domain, array ns_list)
Description
Add the specified name servers to the name servers list of a domain.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
ns_list = ["ns1.example.org", "ns2.example.org"]
try:
	opid = proxy.domain_ns_add(session, domain, ns_list)
	print "adding the name servers is Gandi operation #%d" % opid
except xmlrpclib.Fault, e:
	print "could not add name servers to '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$ns_list = php_xmlrpc_encode(array("ns1.example.org", "ns2.example.org"));
$msg = new xmlrpcmsg("domain_ns_add", array($session, new xmlrpcval($domain), $ns_list));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not add name servers to '%s' because: %s\n", $domain, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("adding the name servers is Gandi operation #%d\n", $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $ns_list = ["ns1.example.org", "ns2.example.org"]
my $reply = $proxy->call("domain_ns_add", $session, $domain, $ns_list);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not add name servers to '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "adding the name servers is Gandi operation #%d\n", $opid;
}
	

domain_ns_del

Signature
int domain_ns_del(string session, string domain, array ns_list)
Description
Remove the specified name servers from the name servers list of a domain.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
ns_list = ["ns1.example.org", "ns2.example.org"]
try:
	opid = proxy.domain_ns_del(session, domain, ns_list)
	print "removing the name servers from '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not remove name servers from '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$ns_list = php_xmlrpc_encode(array("ns1.example.org", "ns2.example.org"));
$msg = new xmlrpcmsg("domain_ns_del", array($session, new xmlrpcval($domain), $ns_list));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not remove name servers from '%s' because: %s\n", $domain, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("removing the name servers from '%s' is Gandi operation #%d\n", $domain, $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $ns_list = ["ns1.example.org", "ns2.example.org"]
my $reply = $proxy->call("domain_ns_del", $session, $domain, $ns_list);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not remove name servers from '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "removing the name servers from '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_ns_set

Signature
int domain_ns_set(string session, string domain, array ns_list)
Description
Set a domain name servers list.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
domain = "example.net"
ns_list = ["ns1.example.org", "ns2.example.org"]
try:
	opid = proxy.domain_ns_set(session, domain, ns_list)
	print "setting the nameservers of '%s' is Gandi operation #%d" % (domain, opid)
except xmlrpclib.Fault, e:
	print "could not set the name servers list of '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$ns_list = php_xmlrpc_encode(array("ns1.example.org", "ns2.example.org"));
$msg = new xmlrpcmsg("domain_ns_set", array($session, new xmlrpcval($domain), $ns_list));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not set the name servers of '%s' because: %s\n", $domain, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("setting the nameservers is Gandi operation #%d\n", $val);
}
	
Sample code (perl)
my $domain = "example.net";
my $ns_list = ["ns1.example.org", "ns2.example.org"]
my $reply = $proxy->call("domain_ns_set", $session, $domain, $ns_list);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not set the name servers of '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "setting the nameservers of '%s' is Gandi operation #%d\n", $domain, $opid;
}
	

domain_web_redir_list

Signature
array domain_web_redir_list(string session, string domain)
Description
Retrieve the web redirections of a domain.
Parameters
Returns
The XML-RPC response will contain an array of web redirections (struct) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
try:
	domain = "example.net"
	redir_array = proxy.domain_web_redir_list(session, domain)
	print "web redirections for '%s':" % domain
	pprint.pprint(redir_array)
except xmlrpclib.Fault, e:
	print "could not get the list of web redirections of domain '%s' because: %s" % (domain, e.faultString)
	
Sample code (php)
$domain = "example.net";
$msg = new xmlrpcmsg("domain_web_redir_list", array($session, new xmlrpcval($domain)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not get the list of web redirections of domain '%s' because: %s\n", $domain, $reply->faultString());
}  
else {
	printf("web redirections for '%s':\n", $domain);
	$val = php_xmlrpc_decode($reply->value());
	print_r($val);
}  
	
Sample code (perl)
my $domain = "example.net";
my $reply = $proxy->call("domain_web_redir_list", $session, $domain);
my $redir_array = $reply->result();
unless (defined $redir_array) {
	printf "could not get the list of web redirections of domain '%s' because: %s\n", $domain, $reply->faultstring;
}
else {
	printf "web redirections for '%s':\n", $domain;
	print Dumper($redir_array);
}
	

domain_web_redir_add

Signature
int domain_web_redir_add(string session, string fqdn, string destination_url, string type)
Description
Add a web redirection to a domain. All HTTP requests to http://fqdn/ will be redirected to 'destination_url' with a HTTP redirection 'type'
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
fqdn = "example.net"
url = "http://www.example.org/~johndoe/"
try:
	opid = proxy.domain_web_redir_add(session, fqdn, url, "http302")
	print "adding the web redirection 'http://%s/' -> '%s' (http302) is Gandi operation #%d" % (fqdn, url, opid)
except xmlrpclib.Fault, e:
	print "could not add the web redirection 'http://%s' -> '%s' because: %s" % (fqdn, url, e.faultString)
	
Sample code (php)
$fqdn = "example.net";
$url = "http://www.example.org/~johndoe/";
$msg = new xmlrpcmsg("domain_web_redir_add", array($session, new xmlrpcval($fqdn), new xmlrpcval($url), new xmlrpcval("http302")));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not add the web redirection 'http://%s' -> '%s' because: %s\n", $fqdn, $url, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("adding the web redirection 'http://%s' -> '%s' is Gandi operation #%d\n", $fqdn, $url, $val);
}
	
Sample code (perl)
my $fqdn = "example.net";
my $url = "http://www.example.org/~johndoe/";
my $reply = $proxy->call("domain_web_redir_add", $session, $fqdn, $url, "http302");
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not add the web redirection 'http://%s' -> '%s' because: %s\n", $fqdn, $url, $reply->faultstring;
}
else {
	printf "adding the web redirection 'http://%s' -> '%s' is Gandi operation #%d\n", $fqdn, $url, $opid;
}
	

domain_web_redir_del

Signature
int domain_web_redir_del(string session, string fqdn)
Description
Delete the web redirection of the fully qualified domain name fqdn.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
fqdn = "example.net"
try:
	opid = proxy.domain_web_redir_del(session, fqdn)
	print "deleting the web redirection 'http://%s' is Gandi operation #%d" % (fqdn, opid)
except xmlrpclib.Fault, e:
	print "could not delete the web redirection 'http://%s' because: %s" % (fqdn, e.faultString)
	
Sample code (php)
$fqdn = "example.net";
$msg = new xmlrpcmsg("domain_web_redir_del", array($session, new xmlrpcval($fqdn)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not delete the web redirection 'http://%s' -> '%s' because: %s\n", $fqdn, $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("deleting the web redirection 'http://%s -> $s' is Gandi operation #%d\n", $fqdn, $val);
}
	
Sample code (perl)
my $fqdn = "example.net";
my $reply = $proxy->call("domain_web_redir_del", $session, $fqdn);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not delete the web redirection '%s' because: %s\n", $fqdn, $reply->faultstring;
}
else {
	printf "deleting the web redirection '%s' is Gandi operation #%d\n", $fqdn, $opid;
}
	

contact_create

Signature
string contact_create(string session, string class, string firstname, string lastname, string address, string zipcode, string city, string country, string phone, string email [, struct params])
Description
Create a Gandi contact of a given type. See glossary, Account.
Parameters
Optional and additional parameters
Returns
The XML-RPC response will return the Gandi handle (string) of the contact created or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python) - a contact creation for an individual who wants to register a .fr
class = "individual"
firstname = "Sophie"
lastname = "Gandi"
address = "15 place de la Nation"
zipcode = "75011"
city = "Paris"
country = "FR"
phone = "+33.102030405"
email = "sophie@example.com"
params = {}
params['birth_date'] = xmlrpclib.DateTime("1981-10-06")
params['birth_place'] = "Versailles"
params['birth_dpt'] = "78"
params['birth_country'] = "FR"
try:
	handle = proxy.contact_create(session, class, firstname, lastname, address, zipcode, city, country, phone, email, params)
	print "created contact: %s" % handle
except xmlrpclib.Fault, e:
	print 	"could not create contact because: %d" % (e.faultString)
	
Sample code (php) - a contact creation for an individual who wants to register a .fr
$class = new xmlrpcval("individual");
$firstname = new xmlrpcval("Sophie");
$lastname = new xmlrpcval("Gandi");
$address = new xmlrpcval("15 place de la Nation");
$zipcode = new xmlrpcval("75011");
$city = new xmlrpcval("Paris");
$country = new xmlrpcval("FR");
$phone = new xmlrpcval("+33.102030405", "string");
$email = new xmlrpcval("sophie@example.com");
$params["birth_date"] = new xmlrpcval("19811006T00:00:00", "dateTime.iso8601");
$params["birth_place"] = new xmlrpcval("Versailles");
$params["birth_dpt"] = new xmlrpcval("78", "string");
$params["birth_country"] = new xmlrpcval("FR");
$params = php_xmlrpc_encode($params);

$msg = new xmlrpcmsg("contact_create", array($session, $class, $firstname, $lastname, $address, $zipcode, $city, $country, $phone, $email, $params));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not create contact because: %s\n", $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("created contact: %s\n", $val);
}
	
Sample code (perl) - a contact creation for an individual who wants to register a .fr
my $class = "individual";
my $firstname = "Sophie";
my $lastname = "Gandi";
my $address = "15 place de la Nation";
my $zipcode = "75011";
my $city = "Paris";
my $country = "FR";
my $phone = "+33.102030405";
my $email = "sophie\@example.com";
my $params = {};
$params["birth_date"] = XMLRPC::Data->type('datetime')->value('19811006T00:00:00');
$params["birth_place"] = "Versailles";
$params["birth_dpt"] = "78";
$params["birth_country"] = "FR";
my $reply = $proxy->call("contact_create", $session, $class, $firstname, $lastname, $address, $zipcode, $city, $country, $phone, $email, $params);
my $handle = $reply->result();
unless (defined $handle) {
	printf "could not create contact because: %s\n", $reply->faultstring;
}
else {
	printf "created contact: %s\n", $handle;
}
	
Sample code (python) - a contact creation for a company that wants to register a .com
class = "company"
firstname = "Marc"
lastname = "Reseau"
address = "38 rue des hirondelles"
zipcode = "75012"
city = "Paris"
country = "FR"
phone = "+33.504030201"
email = "marc@example.org"
params = {}
params['company_name'] = "Example Inc."
params['insee_siren'] = "48327119900024"
params['trademark_number'] = "385070345"
params['tva'] = "FR3744103456"
try:
	handle = proxy.contact_create(session, class, firstname, lastname, address, zipcode, city, country, phone, email, params)
	print "created contact: %s" % handle
except xmlrpclib.Fault, e:
	print 	"could not create contact because: %s" % e.faultString
	
Sample code (php) - a contact creation for a company that wants to register a .com
$class = new xmlrpcval("company");
$firstname = new xmlrpcval("Marc");
$lastname = new xmlrpcval("Reseau");
$address = new xmlrpcval("38 rue des hirondelles");
$zipcode = new xmlrpcval("75012");
$city = new xmlrpcval("Paris");
$country = new xmlrpcval("FR");
$phone = new xmlrpcval("+33.504030201", "string");
$email = new xmlrpcval("marc@example.org");

$params = php_xmlrpc_encode(array(
		"company_name" => "Example Inc.",
		"insee_siren" => "48327119900024",
		"trademark_number" => "385070345",
		"tva" => "FR3744103456"
	)
);

$msg = new xmlrpcmsg("contact_create", array($session, $class, $firstname, $lastname, $address, $zipcode, $city, $country, $phone, $email, $params));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not create contact because: %s\n", $reply->faultString());
}  
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("created contact: %s\n", $val);
}
	
Sample code (perl) - a contact creation for a company that wants to register a .com
my $class = "company";
my $firstname = "Marc";
my $lastname = "Reseau";
my $address = "38 rue des hirondelles";
my $zipcode = "75012";
my $city = "Paris";
my $country = "FR";
my $phone = "+33.504030201";
my $email = "marc\@example.org";
my $params = {};
$params["company_name"] = "Example Inc.";
$params["insee_siren"] = "48327119900024";
$params["trademark_number"] = "385070345";
$params["tva"] = "FR3744103456";
my $reply = $proxy->call("contact_create", $session, $class, $firstname, $lastname, $address, $zipcode, $city, $country, $phone, $email, $params);
my $handle = $reply->result();
unless (defined $handle) {
	printf "could not create contact because: %s\n", $reply->faultstring;
}
else {
	printf "created contact: %s\n", $handle;
}
	

contact_update

Signature
int contact_update(string session, string handle, struct params)
Description
Update a Gandi contact.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
handle = "AA1234-GANDI"
params = {}
params['address'] = "123 rue des alouettes"
params['city'] = "Versailles"
params['zipcode'] = "78000"
try:
	opid = proxy.contact_update(session, handle, params)
	print "update of contact '%s' is Gandi operation #%d" % (handle, opid)
except xmlrpclib.Fault, e:
	print "could not update contact '%s' because: %s" % handle, e.faultString
	
Sample code (php)
$handle = "AA1234-GANDI";
$params = php_xmlrpc_encode(array(
		"address" => "123 rue des alouettes",
		"city" => "Versailles",
		"zipcode" => "78000",
	)
);
$msg = new xmlrpcmsg("contact_update", array($session, new xmlrpcval($handle), $params));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not update contact '%s' because: %s\n", $handle, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("update of contact '%s' is Gandi operation: #%d\n", $handle, $val);
}
	
Sample code (perl)
my $handle = "AA1234-GANDI";
my $params = {};
$params["address"] = "123 rue des alouettes";
$params["city"] = "Versailles";
$params["zipcode"] = "78000";
my $reply = $proxy->call("contact_update", $session, $handle, $params);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not update contact '%s' because: %s\n", $opid, $reply->faultstring;
}
else {
	printf "update of contact '%s' is Gandi operation #%d\n", $handle, $opid;
}
	

contact_del

Signature
int contact_del(string session, string handle)
Description
Delete a Gandi contact.
Parameters
Returns
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
handle = "AA1234-GANDI"
try:
	opid = proxy.contact_del(session, handle)
	print "deletion of contact '%s' is Gandi operation #%d" % (handle, opid)
except xmlrpclib.Fault, e:
	print "could not delete contact '%s' because: %s" % (handle, e.faultString)
	
Sample code (php)
$handle = "AA1234-GANDI";
$msg = new xmlrpcmsg("contact_del", array($session, new xmlrpcval($handle)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not delete contact '%s' because: %s\n", $handle, $reply->faultString());
}
else {
	$val = $reply->value();
	$val = $val->scalarval();
	printf("deletion of contact '%s' is Gandi operation: #%d\n", $handle, $val);
}
	
Sample code (perl)
my $handle = "AA1234-GANDI";
my $reply = $proxy->call("contact_del", $session, $handle);
my $opid = $reply->result();
unless (defined $opid) {
	printf "could not update contact '%s' because: %s\n", $opid, $reply->faultstring;
}
else {
	printf "deletion of contact '%s' is Gandi operation #%d\n", $handle, $opid;
}
	

contact_info

Signature
struct contact_info(string session, string handle)
Description
Retrieve a Gandi contact informations.
Parameters
Returns
The XML-RPC response will contain the Gandi contact informations (struct) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
handle = "AA1234-GANDI"
try:
	contact_info = proxy.contact_info(session, handle)
	print "informations for contact '%s'" % handle
	pprint.pprint(contact_info)
except xmlrpclib.Fault, e:
	print "could not retrieve informations of contact '%s' because: %s" % (handle, e.faultString)
	
Sample code (php)
$handle = "AA1234-GANDI";
$msg = new xmlrpcmsg("contact_info", array($session, new xmlrpcval($handle)));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not retrieve informations of contact '%s' because: %s\n", $handle, $reply->faultString());
}
else {
	$val = php_xmlrpc_decode($reply->value());
	printf("informations for contact '%s'\n", $handle);
	print_r($val);
}
	
Sample code (perl)
my $handle = "AA1234-GANDI";
my $reply = $proxy->call("contact_info", $session, $handle);
my $info = $reply->result();
unless (defined $opid) {
	printf "could not retrieve informations of contact '%s' because: %s\n", $handle, $reply->faultstring;
}
else {
	printf "informations for contact '%s'\n", $handle;
	print Dumper($info);
}
	

operation_list

Signature
array operation_list(string session [, struct filter ])
Description
Retrieves the last 300 operation IDs matching the specified criterias.
Parameters
Returns
The XML-RPC response will contain an array of operations IDs (int) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
try:
	updated_after = xmlrpclib.DateTime("2006-01-01")
	updated_before = xmlrpclib.DateTime("2006-02-01")
	state = "DONE"
	type = "domain_create"
	filter = { "updated_after": updated_after, "updated_before": updated_before, "state": state, "type": domain_create }
	oplist = proxy.operation_list(session, filter)
	print "operations list:"
	pprint.pprint(oplist)
except xmlrpclib.Fault, e:
	print "could not retrieve operations list because: %s" % e.faultString
	
Sample code (php)
$filter = new xmlrpcval(
	array(
		"updated_after" => new xmlrpcval("20060101T00:00:00", "dateTime.iso8601"),
		"updated_before" => new xmlrpcval("20060201T00:00:00", "dateTime.iso8601"),
		"state" => new xmlrpcval("DONE"),
		"type" => new xmlrpcval("domain_create"),
	),
	"struct"
);

$msg = new xmlrpcmsg("operation_list", array($session, $filter));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not retrieve operations list because: %s\n", $reply->faultString());
}
else {
   $val = php_xmlrpc_decode($reply->value());
	print("operations list:\n");
	print_r($val);
}
	
Sample code (perl)
my $filter = {}
$filter["updated_after"] = XMLRPC::Data->type("datetime")->value("20060101T00:00:00");
$filter["updated_before"] = XMLRPC::Data->type("datetime")->value("20060201T00:00:00");
$filter["state"] = "DONE";
$filter["type"] = "domain_create";
my $reply = $proxy->call("operation_list", $session, $filter);
my $oplist = $reply->result();
unless (defined $oplist) {
	printf "could not retrieve operations list because: %s\n", $reply->faultstring;
}
else {
	print "operations list:\n";
	print Dumper($oplist);
}
	

operation_details

Signature
struct operation_details(string session, int opid)
Description
Retrieve an operation details.
Parameters
Returns
The XML-RPC response will contain an operation details (struct) or a fault describing the problem.
The returned struct contains the following keys:
Possible faults are described in section Error Codes Format.
Sample code (python)
import pprint
opid = 1234
try:
	opdetails = proxy.operation_details(session, opid)
	pprint.pprint(opdetails)
except xmlrpclib.Fault, e:
	print "could not retrieve operation #%d details because: %s" % (opid, e.faultString)
	
Sample code (php)
$opid = 1234;
$msg = new xmlrpcmsg("operation_details", array($session, new xmlrpcval($opid, "int")));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not retrieve operation #%d details because: %s\n", $opid, $reply->faultString());
}
else {
   $val = php_xmlrpc_decode($reply->value());
	print_r($val);
}
	
Sample code (perl)
my $opid = 1234;
my $reply = $proxy->call("operation_details", $session, $opid);
my $opdetails = $reply->result();
unless (defined $opdetails) {
	printf "could not retrieve operation #%d details because: %s\n", $opid, $reply->faultstring;
}
else {
	print Dumper($opdetails);
}
	

operation_relaunch

Signature
boolean operation_relaunch(string session, int opid, struct param)
Description
Relaunch an operation, modifying the given parameters.
Parameters
Returns
The XML-RPC response will return True (boolean) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
opid = 1234
try:
	proxy.operation_relaunch(session, opid, {'auth_code': 'abababab'})
catch xmlrpclib.Fault, e:
	print "could not relaunch operation #%d because: %s" % (opid, e.faultString)
	
Sample code (php)
$opid = 1234;
$params["auth_code"] = new xmlrpcval("abababab");
$params = php_xmlrpc_encode($params);
$msg = new xmlrpcmsg("operation_relaunch", array($session, new xmlrpcval($opid, "int"), $params));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
   printf("could not relaunch operation #%d because: %s\n", $opid, $reply->faultString());
}
	
Sample code (perl)
my $opid = 1234;
my $params = {};
$params["auth_code"] = "abababab";
my $reply = $proxy->call("operation_relaunch", $session, $opid, $params);
my $result = $reply->result();
unless (defined $result) {
	printf "could not relaunch operation #%d because: %s\n", $opid, $reply->faultstring;
}
	

operation_cancel

Signature
boolean operation_cancel(string session, int opid)
Description
Cancel an operation.
Parameters
Returns
The XML-RPC response will return True (boolean) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
opid = 1234
try:
	proxy.operation_cancel(session, opid)
except xmlrpclib.Fault, e:
	print "could not cancel operation #%d because: %s" % (opid, e.faultString)
	
Sample code (php)
$opid = 1234;
$msg = new xmlrpcmsg("operation_cancel", array($session, new xmlrpcval($opid, "int")));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not cancel operation #%d because: %s\n", $opid, $reply->faultString());
}
	
Sample code (perl)
my $opid = 1234;
my $reply = $proxy->call("operation_cancel", $session, $opid);
my $result = $reply->result();
unless (defined $result) {
	printf "could not cancel operation #%d because: %s\n", $opid, $reply->faultstring;
}
	

tld_list

Signature
array tld_list(string session)
Description
Returns the list of active TLDs handled by the application.
Parameters
Returns
The XML-RPC response will return an array of TLDs (string) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
Sample code (python)
try:
	ret = proxy.tld_list(session)
	pprint.pprint(ret)
except xmlrpclib.Fault, e:
	print "could not retrieve the TLD list because: %s" % (e.faultString,)
	
Sample code (php)
$msg = new xmlrpcmsg("tld_list", array($session));
$reply = $proxy->send($msg);
if ($reply->faultCode()) {
	printf("could not retrieve the TLD list because: %s\n", $reply->faultString());
}
else {
	$val = php_xmlrpc_decode($reply->value());
	print_r($val);
}
	
Sample code (perl)
my $reply = $proxy->call("tld_list", $session);
my $result = $reply->result();
unless (defined $result) {
	printf "could not retrieve the TLD list because: %s\n", $reply->faultstring;
}
else {
	print Dumper($result);
}
	

Error codes format

Description

XML-RPC errors are contained in < faults > that have a value (faultCode) encoded as an integer and a message (faultString). The Gandi XML-RPC interface error codes are normalized. The format of Gandi errors is hierarchical and built upon the scheme:

qualification (one digit) object (three digits) cause (two digits)

Qualification

The qualification, encoded on one digit, helps distinguishing between an input error and something that went wrong on the server side. There are two qualifications:

Object

The object, encoded on three digits, depends on the qualification. For a Server qualification it may be Network, Database, System etc. For a Data qualification it is related to the objects passed as arguments, for instance a Phone Number.

Cause

The cause, encoded on two digits, depends on the object. For a Database object it may be a failed query and for a Phone Number it may be a Syntax Error.

Qualification 1 - Server

Objects and causes

100. Database
Causes:
500. Application
Causes:

Message

The message associated to an error code is formatted as follow: ServerError: plain text description of the problem

Sample error codes

faultCodefaultString
110020ServerError: database query failed
110040ServerError: database could not find object
150000ServerError: internal error (error has been logged and will be reported)

Qualification 2 - Data

In this qualification, all the objects share the same causes.

Objects

Causes

Checks on data are done sequentially. Depending on the type, not all checks apply. However, a data validation cycle is the following: first the type is checked, then the syntax and the value, then the existence of the object, then the privileges and, finally, the state.

Message

The message associated to an error code is a plain text representations of the problem. It is formated as follow: DataError: plain text description of the problem [element: value]
Element is the name of the faulty parameter with its value appended after a colon and a space.

Sample error codes

faultCodefaultString
500130DataError: invalid value for password [password: 123456]
510210DataError: invalid type for operation id [opid: test]
510050DataError: not enough privileges to access domain [domain: gandi.net]

Glossary

Domain name

A domain name is an alpha-numeric Internet address, formed by the name that you have chosen, and a TLD. A domain name is most often used to name a website (such as www.gandi.net) or an email address (example@gandi.net). In these examples, "gandi.net" is the domain name; "gandi" the chosen name and "net" the TLD.

A domain name (like gandi.net) is easier to remember than an IP address (such as 217.70.177.41). Moreover, the domain name does not change according to the place where your web or e-mail data is actually hosted: you can change your hosting company or your Internet access provider without having to change the name of your website or your e-mail address.

In terms of syntax, a domain name must contain less than 63 alphanumeric characters (no spaces); domain names are not case-sensitive.

Change of ownership

Change of the name and the address of the domain owner (Registrant). An ownership change does not modify the contacts, nor the DNS of the domain name.

Trade

To transfer a domain and change his owner during the transfer process

Restore

Gandi provides a domain restoration service. It means that if your domain is in "Redemption Period" status, we can restore it for you. The restoration process consists in recovering the domain's previous settings (same owner) and adding one year to the domain's validity. Please, notice that when your domain falls into "Redemption Period" status, it is no longer managed by Gandi, but by the related Registry.

Transfer

A transfer is a change of registrar. This is not to be confused with a change of owner (Change of ownership) or a change of web host.

TLD

Final part of the domain name, that comes after a dot. TLD (Top Level Domain) refers to the Internet zone in which your domain name is located. It is also known as "extension". There are several TLDs:

For each TLD, a worldwide database guarantees that each domain name is the only one in the world. The organization that manages this database is called a registry. Each TLD is created and regulated by a trustee authority.

Account (contact)

This is a code (login, ID) used to identify a person who manages one or several domain names. Each registrar uses their own handle system.

Registry

Organization that manages the centralized database of domain names registered in a TLD zone. It is the authoritative source of information, which updates whois and root nameservers for the TLD with the content of its database.

Whois

Administrative directory, available to everyone on the Internet (for example on our website at http://www.gandi.net/whois). This database has records of all registered domain names, together with the names and contact information of their respective owners.

Publishing and updating this Whois database is a contractual obligation applying to all accredited Registrars such as Gandi. This directory is a useful tool for visualizing owner and contact information of domain names, and in particular to facilitate the notification of a technical or legal problem.

Safe mode

When logging in in safe mode (default), you must use the su function to restrict temporarily your rights to the user you su'ed to before calling another function that handles existing objects (contacts, domains...). This is especially useful if you intend to map the Gandi registration API on a web interface for your clients as it can help mitigate the effects of parameter injection. When logging in unsafe mode, you do not have to su to a particular user.