Dns-zone-records:POST
From Hostway API Documentation
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision: Release 99) |
Corinne.chui (Talk | contribs) m (1 revision) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 180: | Line 180: | ||
=== Status Code === | === Status Code === | ||
− | ; | + | ; 201 OK : Success |
; 400 Bad Request : TTL is below allowed minimum | ; 400 Bad Request : TTL is below allowed minimum | ||
Line 187: | Line 187: | ||
; 404 Not Found : 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 === |
Latest revision as of 18:35, 18 August 2016
[edit] POST /dns/{zone}/records
Creates new DNS zone records.
Contents |
[edit] Request
POST /dns/{zone}/records
[edit] Parameters
- zone - string
- The name of the DNS zone.
[edit] URI Parameters
None.
[edit] Request Headers
- Authorization
- Base64-encoded username:password string
- Content-Type
- application/json
[edit] 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'
[edit] 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
[edit] 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
[edit] 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
[edit] 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
[edit] 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
[edit] 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
[edit] 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
[edit] Response
[edit] 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.
[edit] Response Header
- Location
- The URI of the new DNS record.
[edit] Examples
[edit] 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
[edit] Unauthorized Request
Request
POST /dns/test.com/records { "name": "alt.test.com", "type": "CNAME", "cname": "altdomain.com" }
Response
401 Unauthorized
[edit] 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": ""} }
[edit] See also