Dns-zone-records:POST
From Hostway API Documentation
Revision as of 17:04, 18 February 2013 by Mike.robski (Talk | contribs)
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
A record
{ "name": "{domain}", "type": "A", "address": "{ip_address}" }
AAAA record
{ "name": "{domain}", "type": "AAAA", "address": "{ipv6_address}" }
NS record
{ "name": "{domain}", "type": "NS", "nsdname": "{ns_domain}" }
TXT record
{ "name": "{domain}", "type": "TXT", "data": "{data}" }
SRV record
{ "name": "{domain}", "type": "SRV", "priority": {priority}, "weight": {weight}, "port": {port}, "target": "{target}" }
MX record
{ "name": "{domain}", "type": "MX", "preference": {preference}, "exchange": "{mx_domain}" }
CNAME record
{ "name": "{name}", "type": "CNAME", "cname": "{domain}" }
Response
Status Code
- 200 OK
- Success
- 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