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])
Create a Gandi contact of a given type. See glossary, Account.
struct params: a struct that may contain some of the following fields:
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.
cclass = "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, cclass, 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)
$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); }
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; }
cclass = "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, cclass, 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
$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); }
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; }
int contact_update(string session, string handle, struct params)
Update a Gandi contact.
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.
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
$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); }
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; }
int contact_del(string session, string handle)
Delete a Gandi contact.
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.
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)
$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); }
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; }
struct contact_info(string session, string handle)
Retrieve a Gandi contact informations.
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.
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)
$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); }
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); }
Dernière modification: le 22/06/2011 à 17:02 par Romuald B. (Gandi)