Dns-zone-records:POST

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
 
(6 intermediate revisions by 2 users not shown)
Line 34: Line 34:
 
       @
 
       @
 
   The API will return the record with the zone origin appended to the name, i.e. '@.domain.com'
 
   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 42: Line 43:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 51: Line 61:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 60: Line 79:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 69: Line 97:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 81: Line 118:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 91: Line 146:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 100: Line 167:
 
   "ttl": 3600
 
   "ttl": 3600
 
}</nowiki>
 
}</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 ===
; 200 OK : Success
+
; 201 OK : Success
  
 
; 400 Bad Request : TTL is below allowed minimum
 
; 400 Bad Request : TTL is below allowed minimum
Line 111: 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 ===
Line 125: Line 203:
  
 
{
 
{
   "name": "test",
+
   "name": "alt.test.com",
 
   "type": "CNAME",
 
   "type": "CNAME",
   "cname": "otherdomain.com."
+
   "cname": "altdomain.com"
 
}</nowiki>
 
}</nowiki>
  
Line 142: Line 220:
  
 
{
 
{
   "name": "test",
+
   "name": "alt.test.com",
 
   "type": "CNAME",
 
   "type": "CNAME",
   "cname": "otherdomain.com."
+
   "cname": "altdomain.com"
 
}</nowiki>
 
}</nowiki>
  
Line 159: Line 237:
  
 
{
 
{
   "name": "test",
+
   "name": "alt.test.com",
 
   "type": "CNAME",
 
   "type": "CNAME",
   "cname": "otherdomain.com."
+
   "cname": "altdomain.com"
 
}</nowiki>
 
}</nowiki>
  
Line 175: Line 253:
 
* [[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]]
code>POST /dns/''{zone}''/records
 

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


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox