Dns-zone-records:POST

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

Revision as of 01:35, 8 May 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


blog comments powered by Disqus code>POST /dns/{zone}/records

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox