Dns-zone-records:POST
From Hostway API Documentation
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision) |
Corinne.chui (Talk | contribs) m (1 revision) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 20: | Line 20: | ||
=== Request Body === | === Request Body === | ||
+ | |||
+ | Added support for wildcard domain names. | ||
+ | Ex: | ||
+ | * | ||
+ | *.somedomain.com | ||
+ | The wildcard record name is stored in the database as it is supplied. | ||
+ | If it's missing the zone origin(i.e. '*') the API will return it with the zone | ||
+ | appended, i.e. '*.domain.com'. | ||
+ | |||
+ | |||
+ | Added support for @ records, which represent the origin itself. | ||
+ | Ex: | ||
+ | @ | ||
+ | The API will return the record with the zone origin appended to the name, i.e. '@.domain.com' | ||
====A record==== | ====A record==== | ||
Line 26: | Line 40: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "A", | "type": "A", | ||
− | "address": "{ip_address}" | + | "address": "{ip_address}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; address | ||
+ | : IPv4 address | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
====AAAA record==== | ====AAAA record==== | ||
Line 35: | Line 58: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "AAAA", | "type": "AAAA", | ||
− | "address": "{ipv6_address}" | + | "address": "{ipv6_address}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; address | ||
+ | : IPv6 address | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
====NS record==== | ====NS record==== | ||
Line 44: | Line 76: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "NS", | "type": "NS", | ||
− | "nsdname": "{ns_domain}" | + | "nsdname": "{ns_domain}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; nsdname | ||
+ | : FQDN of the host which should be authoritative for the domain | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
====TXT record==== | ====TXT record==== | ||
Line 53: | Line 94: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "TXT", | "type": "TXT", | ||
− | "data": "{data}" | + | "data": "{data}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; data | ||
+ | : TXT record data | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
====SRV record==== | ====SRV record==== | ||
Line 65: | Line 115: | ||
"weight": {weight}, | "weight": {weight}, | ||
"port": {port}, | "port": {port}, | ||
− | "target": "{target}" | + | "target": "{target}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; priority | ||
+ | : The priority of this target host | ||
+ | |||
+ | ; weight | ||
+ | : Server selection mechanism | ||
+ | |||
+ | ; port | ||
+ | : The port on this target host of this service | ||
+ | |||
+ | ; target | ||
+ | : The domain name of the target host | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
====MX record==== | ====MX record==== | ||
Line 75: | Line 143: | ||
"type": "MX", | "type": "MX", | ||
"preference": {preference}, | "preference": {preference}, | ||
− | "exchange": "{mx_domain}" | + | "exchange": "{mx_domain}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; preference | ||
+ | : Integer which specifies the preference given to this record among others at the same owner | ||
+ | |||
+ | ; exchange | ||
+ | : FQDN which specifies a host willing to act as a mail exchange for the owner name | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
====CNAME record==== | ====CNAME record==== | ||
Line 84: | Line 164: | ||
"name": "{name}", | "name": "{name}", | ||
"type": "CNAME", | "type": "CNAME", | ||
− | "cname": "{domain}" | + | "cname": "{domain}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
+ | |||
+ | ; name | ||
+ | : Fully qualified domain name (FQDN) of the record | ||
+ | |||
+ | ; cname | ||
+ | : FQDN which specifies the canonical or primary name for the owner | ||
+ | |||
+ | ; ttl | ||
+ | : Time to live (TTL) for the record in seconds | ||
== Response == | == Response == | ||
=== Status Code === | === Status Code === | ||
− | ; | + | ; 201 OK : Success |
− | : Success | + | |
− | ; | + | ; 400 Bad Request : TTL is below allowed minimum |
− | : | + | |
− | ;404 Not Found | + | ; 401 Unauthorized : The server could not verify the credentials from the authorization header. |
− | : The specified zone does not exist. | + | |
+ | ; 404 Not Found : The specified zone does not exist. | ||
+ | |||
+ | ; 409 Conflict : Requested record conflicts with existing one. | ||
=== Response Header === | === Response Header === | ||
Line 113: | Line 203: | ||
{ | { | ||
− | "name": "test", | + | "name": "alt.test.com", |
"type": "CNAME", | "type": "CNAME", | ||
− | "cname": " | + | "cname": "altdomain.com" |
− | } | + | }</nowiki> |
− | + | ||
''Response'' | ''Response'' | ||
Line 131: | Line 220: | ||
{ | { | ||
− | "name": "test", | + | "name": "alt.test.com", |
"type": "CNAME", | "type": "CNAME", | ||
− | "cname": " | + | "cname": "altdomain.com" |
− | } | + | }</nowiki> |
− | + | ||
''Response'' | ''Response'' | ||
Line 149: | Line 237: | ||
{ | { | ||
− | "name": "test", | + | "name": "alt.test.com", |
"type": "CNAME", | "type": "CNAME", | ||
− | "cname": " | + | "cname": "altdomain.com" |
− | } | + | }</nowiki> |
− | + | ||
''Response'' | ''Response'' | ||
Line 161: | Line 248: | ||
{ | { | ||
"conflict": {"message": "Data conflict", "code": 409, "details": ""} | "conflict": {"message": "Data conflict", "code": 409, "details": ""} | ||
− | } | + | }</nowiki> |
− | + | ||
== See also == | == See also == | ||
* [[DNS|DNS API]] | * [[DNS|DNS API]] | ||
* [[Common Features]] | * [[Common Features]] | ||
+ | * [http://tools.ietf.org/html/rfc1035 RFC 1035] | ||
+ | * [http://tools.ietf.org/html/rfc2782 RFC 2782] | ||
{{disqus}} | {{disqus}} | ||
[[Category:Hostway API]] | [[Category:Hostway API]] | ||
[[Category:DNS API]] | [[Category:DNS API]] |
Latest revision as of 18:35, 18 August 2016
POST /dns/{zone}/records
Creates new DNS zone records.
Contents |
Request
POST /dns/{zone}/records
Parameters
- zone - string
- The name of the DNS zone.
URI Parameters
None.
Request Headers
- Authorization
- Base64-encoded username:password string
- Content-Type
- application/json
Request Body
Added support for wildcard domain names. Ex: * *.somedomain.com The wildcard record name is stored in the database as it is supplied. If it's missing the zone origin(i.e. '*') the API will return it with the zone appended, i.e. '*.domain.com'.
Added support for @ records, which represent the origin itself. Ex: @ The API will return the record with the zone origin appended to the name, i.e. '@.domain.com'
A record
{ "name": "{domain}", "type": "A", "address": "{ip_address}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- address
- IPv4 address
- ttl
- Time to live (TTL) for the record in seconds
AAAA record
{ "name": "{domain}", "type": "AAAA", "address": "{ipv6_address}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- address
- IPv6 address
- ttl
- Time to live (TTL) for the record in seconds
NS record
{ "name": "{domain}", "type": "NS", "nsdname": "{ns_domain}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- nsdname
- FQDN of the host which should be authoritative for the domain
- ttl
- Time to live (TTL) for the record in seconds
TXT record
{ "name": "{domain}", "type": "TXT", "data": "{data}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- data
- TXT record data
- ttl
- Time to live (TTL) for the record in seconds
SRV record
{ "name": "{domain}", "type": "SRV", "priority": {priority}, "weight": {weight}, "port": {port}, "target": "{target}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- priority
- The priority of this target host
- weight
- Server selection mechanism
- port
- The port on this target host of this service
- target
- The domain name of the target host
- ttl
- Time to live (TTL) for the record in seconds
MX record
{ "name": "{domain}", "type": "MX", "preference": {preference}, "exchange": "{mx_domain}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- preference
- Integer which specifies the preference given to this record among others at the same owner
- exchange
- FQDN which specifies a host willing to act as a mail exchange for the owner name
- ttl
- Time to live (TTL) for the record in seconds
CNAME record
{ "name": "{name}", "type": "CNAME", "cname": "{domain}", "ttl": 3600 }
- name
- Fully qualified domain name (FQDN) of the record
- cname
- FQDN which specifies the canonical or primary name for the owner
- ttl
- Time to live (TTL) for the record in seconds
Response
Status Code
- 201 OK
- Success
- 400 Bad Request
- TTL is below allowed minimum
- 401 Unauthorized
- The server could not verify the credentials from the authorization header.
- 404 Not Found
- The specified zone does not exist.
- 409 Conflict
- Requested record conflicts with existing one.
Response Header
- Location
- The URI of the new DNS record.
Examples
Successful Request
Request
POST /dns/test.com/records Authorization: Basic {base64_encoded(username:password)} { "name": "alt.test.com", "type": "CNAME", "cname": "altdomain.com" }
Response
201 Created Location: https://api.hostway.com/dns/test.com/records/447
Unauthorized Request
Request
POST /dns/test.com/records { "name": "alt.test.com", "type": "CNAME", "cname": "altdomain.com" }
Response
401 Unauthorized
Attempt to create duplicate record
Request
POST /dns/test.com/records Authorization: Basic {base64_encoded(username:password)} { "name": "alt.test.com", "type": "CNAME", "cname": "altdomain.com" }
Response
409 Conflict { "conflict": {"message": "Data conflict", "code": 409, "details": ""} }
See also