Gandi Docs

 |   AAA  |    fr   en  

Questions

Name server methods

domain_ns_list

Signature

array domain_ns_list(string session, string domain)

Description

Retrieve the name servers list of a domain.

Parameters

  • string session: the session id (returned by login)
  • string domain: the domain name to get the name servers list

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

  • string session: the session id (returned by login)
  • string domain: the domain name to add the name servers to
  • array ns_list: the name servers to add in an array of strings

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

  • string session: the session id (returned by login)
  • string domain: the domain name to add the name servers to
  • array ns_list: the name servers to remove in an array of strings

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

  • string session: the session id (returned by login)
  • string domain: the domain name to set the list of name servers
  • array ns_list: the name servers list to set in an array of strings

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;
}

Questions

Aucune question sur cette page et ses sous-pages.

Flux RSS des questions correspondant à ce filtre (Aide)

Dernière modification: le 03/03/2008 à 15:36 par Nicolas L. (Gandi)