Dns-zone-records:POST
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision) |
|||
Line 21: | Line 21: | ||
=== 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==== | ||
<nowiki> | <nowiki> | ||
Line 26: | Line 39: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "A", | "type": "A", | ||
− | "address": "{ip_address}" | + | "address": "{ip_address}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
====AAAA record==== | ====AAAA record==== | ||
Line 35: | Line 48: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "AAAA", | "type": "AAAA", | ||
− | "address": "{ipv6_address}" | + | "address": "{ipv6_address}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
====NS record==== | ====NS record==== | ||
Line 44: | Line 57: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "NS", | "type": "NS", | ||
− | "nsdname": "{ns_domain}" | + | "nsdname": "{ns_domain}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
====TXT record==== | ====TXT record==== | ||
Line 53: | Line 66: | ||
"name": "{domain}", | "name": "{domain}", | ||
"type": "TXT", | "type": "TXT", | ||
− | "data": "{data}" | + | "data": "{data}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
====SRV record==== | ====SRV record==== | ||
Line 65: | Line 78: | ||
"weight": {weight}, | "weight": {weight}, | ||
"port": {port}, | "port": {port}, | ||
− | "target": "{target}" | + | "target": "{target}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
====MX record==== | ====MX record==== | ||
Line 75: | Line 88: | ||
"type": "MX", | "type": "MX", | ||
"preference": {preference}, | "preference": {preference}, | ||
− | "exchange": "{mx_domain}" | + | "exchange": "{mx_domain}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
====CNAME record==== | ====CNAME record==== | ||
Line 84: | Line 97: | ||
"name": "{name}", | "name": "{name}", | ||
"type": "CNAME", | "type": "CNAME", | ||
− | "cname": "{domain}" | + | "cname": "{domain}", |
− | + | "ttl": 3600 | |
− | + | }</nowiki> | |
== Response == | == Response == | ||
=== Status Code === | === Status Code === | ||
− | ;200 OK | + | ; 200 OK : Success |
− | : Success | + | |
+ | ; 400 Bad Request : TTL is below allowed minimum | ||
− | ;401 Unauthorized | + | ; 401 Unauthorized : The server could not verify the credentials from the authorization header. |
− | : The server could not verify the credentials from the authorization header. | + | |
− | ;404 Not Found | + | ; 404 Not Found : The specified zone does not exist. |
− | : The specified zone does not exist. | + | |
=== Response Header === | === Response Header === | ||
Line 116: | Line 128: | ||
"type": "CNAME", | "type": "CNAME", | ||
"cname": "otherdomain.com." | "cname": "otherdomain.com." | ||
− | } | + | }</nowiki> |
− | + | ||
''Response'' | ''Response'' | ||
Line 134: | Line 145: | ||
"type": "CNAME", | "type": "CNAME", | ||
"cname": "otherdomain.com." | "cname": "otherdomain.com." | ||
− | } | + | }</nowiki> |
− | + | ||
''Response'' | ''Response'' | ||
Line 152: | Line 162: | ||
"type": "CNAME", | "type": "CNAME", | ||
"cname": "otherdomain.com." | "cname": "otherdomain.com." | ||
− | } | + | }</nowiki> |
− | + | ||
''Response'' | ''Response'' | ||
Line 161: | Line 170: | ||
{ | { | ||
"conflict": {"message": "Data conflict", "code": 409, "details": ""} | "conflict": {"message": "Data conflict", "code": 409, "details": ""} | ||
− | } | + | }</nowiki> |
− | + | ||
== See also == | == See also == | ||
Line 171: | Line 179: | ||
[[Category:Hostway API]] | [[Category:Hostway API]] | ||
[[Category:DNS API]] | [[Category:DNS API]] | ||
+ | code>POST /dns/''{zone}''/records |
Revision as of 05:53, 25 April 2014
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 }
AAAA record
{ "name": "{domain}", "type": "AAAA", "address": "{ipv6_address}", "ttl": 3600 }
NS record
{ "name": "{domain}", "type": "NS", "nsdname": "{ns_domain}", "ttl": 3600 }
TXT record
{ "name": "{domain}", "type": "TXT", "data": "{data}", "ttl": 3600 }
SRV record
{ "name": "{domain}", "type": "SRV", "priority": {priority}, "weight": {weight}, "port": {port}, "target": "{target}", "ttl": 3600 }
MX record
{ "name": "{domain}", "type": "MX", "preference": {preference}, "exchange": "{mx_domain}", "ttl": 3600 }
CNAME record
{ "name": "{name}", "type": "CNAME", "cname": "{domain}", "ttl": 3600 }
Response
Status Code
- 200 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.
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": "test", "type": "CNAME", "cname": "otherdomain.com." }
Response
201 Created Location: https://api.hostway.com/dns/test.com/records/447
Unauthorized Request
Request
POST /dns/test.com/records { "name": "test", "type": "CNAME", "cname": "otherdomain.com." }
Response
401 Unauthorized
Attempt to create duplicate record
Request
POST /dns/test.com/records Authorization: Basic {base64_encoded(username:password)} { "name": "test", "type": "CNAME", "cname": "otherdomain.com." }
Response
409 Conflict { "conflict": {"message": "Data conflict", "code": 409, "details": ""} }
See also