|
|
domedit($domain, $edit, $auth) : Domain editing
Domain editing is a little more complicated. The procedure takes
the domain name, the list of changes stored in a hash, and a set
of credentials also in a hash. The credentials hash does two
things:
- It describes the person editing the domain: either in
relative terms to the domain e.g. org or admin, or in absolute
terms i.e. the contact identifier.
- It provides proof that the editor really is who he claims. At
the moment this is simply the contact's password.
For example, if the editor is the domain's registrant and his
password is `elephant', then the credential hash should be
{ role => 'org', password => 'elephant' }
Sometimes the editor will be associated with more than one role,
perhaps the domain's technical and billing contacts. In such
circumstances, simply join the roles with colons e.g. `tech:bill'.
Alternatively an absolute description can be supplied e.g.
{ contact_id => 'edito763e', password => 'gibbon' }
| Arguments to domedit() |
| Argument | Description |
| domain | The domain name |
| update hash |
| Key |
Description |
Valid editors |
| org |
Registrant's identifier |
org |
| admin |
Admin. contact's identifier |
org, admin |
| bill |
Billing contact's identifier |
org, admin, bill |
| tech |
Technical contact's identifier |
org, admin, tech |
| rr |
Array of resource records |
org, admin, tech |
| ns |
Nameservers (special case of above) |
org, admin, tech |
If one wanted to change a domain's technical contact the
update hash might be { tech => 'abc123x' }.
|
| credentials |
| Key |
Description |
| contact_id |
Identifier of editor e.g. edito673d |
| role |
Relationship to domain of editor (org, admin, bill, or
tech) |
| password |
Editor's password |
Note: either contact_id or role should be supplied,
but not both
|
Resource records
Unlike many other registries AdamsNames allows a more general set
of resource records to be registered for each domain. In simple
cases this will obviate the need to set up extra nameservers for
the domain. The standard interface then, simply accepts a list of
resource records and puts them in the relevant ccTLD zone file.
Obviously this doesn't preclude delegating the domain in the
traditional fashion. Please note however, that it is an error to
mix the two models: a domain is either delegated or not delegated.
| Resource record (RR) description |
| Hash tag | Description |
| rclass |
Class of RR: a, ns, txt, or mx. |
| rdata |
The data itself e.g. IP address for A record, name of
nameserver. |
| rpriority |
Priority of RR: only relevant for MX records. |
| rname |
Name of RR within domain e.g. www |
| Example RRs for the
foo.tc domain |
| Hash | Description |
| { rclass => 'a', rdata => '123.45.67.89' } |
A simple address record: foo.tc has address 123.45.67.89 |
| { rname => 'www', rclass => 'a', rdata => '123.45.67.89' } |
An address record: www.foo.tc has address 123.45.67.89 |
| { rclass => 'mx', rpriority => 10, rdata => 'mail.foo.com' } |
A mail exchanger record. Mail for foo.tc should be sent to mail.foo.com |
| { rclass => 'ns', rdata => 'ns1.foo.com' } |
A nameserver record: foo.tc is delegated to ns1.foo.com |
It is important to realize that the edit here applies to the set
of all resource records i.e. all the old records are deleted and
replaced by the new set. There is no mechanism for updating a
single record.
The price for this flexibility is extra complexity for client code
in the common case of straightforward delegation to
nameservers. Strictly the complexity only occurs when the
nameservers lie within the zone itself, because then care must be
taken to provide the correct `glue records'. For people in this
position, we provide an alternative API: rather than supplying a
list of resource records, simply supply a list of nameservers and
we'll handle it.
| Nameserver (NS) description |
| Hash tag | Description |
| name |
Name of nameserver e.g. ns1.foo.com |
| ipaddr |
IP address of nameserver e.g. 123.45.67.89 (only needed if
the nameserver lies within the domain). |
Typically people delegating domains can simply pass a simple ns
array e.g.
[
{ name => 'ns1.foo.com', ipaddr => '123.45.67.89' },
{ name => 'ns2.foo.com', ipaddr => '123.45.89.67' },
]
| Hash returned by domedit() |
| Hash Key | Description |
| error |
An array of error messages which may include:
| Code | Description |
| 300 | Insufficient credentials for edit |
| 305 | Invalid password |
| 310 | Invalid argument format |
| 320 | Domain definition not valid |
| 321 | Domain not found |
| 322 | Contact not found |
| 400 | Updates modified before edit |
| 500 | Fatal error in query |
| 510 | Fatal error in query |
|
Examples
In the examples below the xmlrpcdemo417487.tc domain has these
contacts:
| Registrant | adams364d |
| Admin. contact | adams516c |
| Billing contact | adams555f |
| Technical contact | adams530y |
The registrant changes the nameservers
Request
domedit('xmlrpcdemo417487.tc',
{ 'ns' => [
{ 'ipaddr' => '123.45.67.89', 'name' => 'ns1.acme.com' },
{ 'ipaddr' => '123.45.67.98', 'name' => 'ns2.acme.com' }
] },
{ 'contact_id' => 'adams364d', 'password' => 'abcdef650643' })
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>domedit</methodName>
<params>
<param>
<value><string>xmlrpcdemo417487.tc</string></value>
</param>
<param>
<value>
<struct>
<member>
<name>ns</name>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>ipaddr</name>
<value><string>123.45.67.89</string></value>
</member>
<member>
<name>name</name>
<value><string>ns1.acme.com</string></value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>ipaddr</name>
<value><string>123.45.67.98</string></value>
</member>
<member>
<name>name</name>
<value><string>ns2.acme.com</string></value>
</member>
</struct>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>contact_id</name>
<value><string>adams364d</string></value>
</member>
<member>
<name>password</name>
<value><string>abcdef650643</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
Return
{
'error' => []
}
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>error</name>
<value>
<array><data/></array>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
The billing contact tries to change the DNS
Request
domedit('xmlrpcdemo417487.tc',
{ 'rr' => [ { 'rclass' => 'txt', 'rdata' => 'This is bogus' } ] },
{ 'contact_id' => 'adams555f', 'password' => 'abcdef047025' })
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>domedit</methodName>
<params>
<param>
<value><string>xmlrpcdemo417487.tc</string></value>
</param>
<param>
<value>
<struct>
<member>
<name>rr</name>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>rclass</name>
<value><string>txt</string></value>
</member>
<member>
<name>rdata</name>
<value><string>This is bogus</string></value>
</member>
</struct>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>contact_id</name>
<value><string>adams555f</string></value>
</member>
<member>
<name>password</name>
<value><string>abcdef047025</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
Return
{
'error' => [
[
300,
'Insufficient credentials to change RRs'
]
]
}
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>error</name>
<value>
<array>
<data>
<value>
<array>
<data>
<value>
<int>300</int>
</value>
<value>
<string>Insufficient credentials...</string>
</value>
</data>
</array>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
|