Dns-zone-records:POST

(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 100)

Revision as of 23:09, 18 November 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
}
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

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.
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