Dns-zone-records:GET

From Hostway API Documentation
Revision as of 07:53, 15 September 2014 by Mike.robski (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GET /dns/{zone}/records

Returns the DNS zone records.

Contents

Request

GET /dns/{zone}/records

Parameters

zone - string
The name of the DNS zone.

URI Parameters

filterType
Optional. Specifies the type of records to return: A, AAAA, NS, TXT, SRV, MX, CNAME
page - number
Optional. Specifies the page to return in paginated response. Default is 1.
pageSize - number
Optional. Specifies the number of records per page. Default 10, Max 100.

Request Headers

Authorization
Base64-encoded username:password string

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 Body

{
  "list": [
    {
      "id": {id},
      "name": "{domain}",
      "type: "AAAA",
      "ttl": {ttl},
      "address": "{ipv6_address}",
      "links": [
        {"href": "https://api.hostway.com/dns/{zone}/records/{id}/", "rel": "self"}
      ]
    },
    {
      "id": {id},
      "name": "{domain}",
      "type: "A",
      "ttl": {ttl},
      "address": "{ipv4_address}",
      "links": [
        {"href": "https://api.hostway.com/dns/{zone}/records/{id}/", "rel": "self"}
      ]
    }
  ],
  "links": [
    {"href": "https://api.hostway.com/dns/{zone}/records/", "rel": "self"}
  ]
}
 

Parameters

list - list
list of DNS records
id - integer
The record's ID
id - string
The record's type. Possible values are A, AAA, NS, CNAME, MX, SVR or TXT. Both SPF and TXT records will appear as TXT and share the same record structure.
ttl - integer
DNS record's TTL in seconds
links - list
Hypermedia to a particular DNS record
other type-specific parameters (optional)
contains type-specific data. See Record Structures for more information.
links - list
Hypermedia for the current DNS records list resource. May include links with information for the pagination.

Record Structures

The goal of this section is to show the presentation of each DNS record in the response body based on the the record's type. The structure of each DNS record depends only on the record's type i.e. A, AAA, NS, CNAME, MX, SVR or TXT.

A record
{ 
  "id": {record_id},
  "name": "{domain}",
  "type": "A",
  "address": "{ip_address}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}
AAAA record
{ 
  "id": {record_id},
  "name": "{domain}",
  "type": "AAAA",
  "address": "{ipv6_address}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}
NS record
{ 
  "id": {record_id},
  "name": "{domain}",
  "type": "NS",
  "nsdname": "{ns_domain}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}
TXT and SPF records
{ 
  "id": {record_id},
  "name": "{domain}",
  "type": "TXT",
  "data": "{data}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}

Note: SPF records also appear as TXT records.

SRV record
{ 
  "id": {record_id},
  "name": "{domain}",
  "type": "SRV",
  "priority": {priority},
  "weight": {weight},
  "port": {port},
  "target": "{target}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}
MX record
{ 
  "id": {record_id},
  "name": "{domain}",
  "type": "MX",
  "preference": {preference},
  "exchange": "{mx_domain}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}
CNAME record
{ 
  "id": {record_id},
  "name": "{name}",
  "type": "CNAME",
  "cname": "{domain}",
  "ttl": 3600,
  "links": [
    {
      "href": "{server_name}/dns/{zone}/records/{record_id}",
      "rel": "self"
    }
  ]
}

Examples

Get a list of DNS records

By default, the DNS records list is paginated to 10 records per page. If the page is not specified, first page will be returned.

GET http://servername/dns/ng-test-hwus-petre-101202.com/records

{
  "list" : [ {
    "name" : "ftp.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/10865/",
      "rel" : "self"
    } ],
    "ttl" : 14400,
    "address" : "10.10.100.60",
    "type" : "A",
    "id" : 10865
  }, {
    "name" : "ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/10866/",
      "rel" : "self"
    } ],
    "ttl" : 14400,
    "address" : "10.10.100.60",
    "type" : "A",
    "id" : 10866
  }, {
    "name" : "www.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/10864/",
      "rel" : "self"
    } ],
    "ttl" : 14400,
    "address" : "10.10.100.60",
    "type" : "A",
    "id" : 10864
  }, {
    "name" : "test-ipv6.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179100/",
      "rel" : "self"
    } ],
    "ttl" : 3000,
    "address" : "2001:0db8:85a3:0042:1000:8a2e:0370:7334",
    "type" : "AAAA",
    "id" : 179100
  }, {
    "name" : "sourcename.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179042/",
      "rel" : "self"
    } ],
    "cname" : "destinationdomain.com",
    "ttl" : 14400,
    "type" : "CNAME",
    "id" : 179042
  }, {
    "name" : "mail.ng-test-hwus-petre-101202.com.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179043/",
      "rel" : "self"
    } ],
    "exchange" : "mail.destination.com.ng-test-hwus-petre-101202.com",
    "preference" : 3,
    "ttl" : 14400,
    "type" : "MX",
    "id" : 179043
  }, {
    "name" : "ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/10860/",
      "rel" : "self"
    } ],
    "nsdname" : "vpdns.debian.hps.hostway",
    "ttl" : 14400,
    "type" : "NS",
    "id" : 10860
  }, {
    "name" : "ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/10861/",
      "rel" : "self"
    } ],
    "nsdname" : "vpdns2.debian.hps.hostway",
    "ttl" : 14400,
    "type" : "NS",
    "id" : 10861
  }, {
    "name" : "_service1._tcp.ng-test-hwus-petre-101202.com",
    "weight" : 3,
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179041/",
      "rel" : "self"
    } ],
    "port" : 80,
    "priority" : 2,
    "ttl" : 14400,
    "type" : "SRV",
    "id" : 179041,
    "target" : "svc-dest.ng-test-hwus-petre-101202.com"
  }, {
    "name" : "spf-test.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179065/",
      "rel" : "self"
    } ],
    "data" : "v=spf1 exists:example.com -all",
    "ttl" : 14400,
    "type" : "TXT",
    "id" : 179065
  } ],
  "links" : [ {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/",
    "rel" : "self"
  }, {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records?page=2",
    "rel" : "next"
  }, {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records?page=2",
    "rel" : "last"
  } ]
}

Get a paginated list of DNS records

By default, the DNS records list is paginated to 10 records per page, if the pageSize parameter is not specified.

GET http://servername/dns/ng-test-hwus-petre-101202.com/records?page=2

{
  "list" : [ {
    "name" : "test-text.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179044/",
      "rel" : "self"
    } ],
    "data" : "test text",
    "ttl" : 14400,
    "type" : "TXT",
    "id" : 179044
  } ],
  "links" : [ {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records?page=2",
    "rel" : "self"
  }, {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records?page=1",
    "rel" : "first"
  }, {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records?page=1",
    "rel" : "previous"
  } ]
}

Get a filtered list of DNS records

Filtered by type.

GET http://servername/dns/ng-test-hwus-petre-101202.com/records?filterType=TXT

{
  "list" : [ {
    "name" : "spf-test.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179065/",
      "rel" : "self"
    } ],
    "data" : "v=spf1 exists:example.com -all",
    "ttl" : 14400,
    "type" : "TXT",
    "id" : 179065
  }, {
    "name" : "test-text.ng-test-hwus-petre-101202.com",
    "links" : [ {
      "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records/179044/",
      "rel" : "self"
    } ],
    "data" : "test text",
    "ttl" : 14400,
    "type" : "TXT",
    "id" : 179044
  } ],
  "links" : [ {
    "href" : "http://servername/dns/ng-test-hwus-petre-101202.com/records?filterType=TXT",
    "rel" : "self"
  } ]
}

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox