11 API Records
Lukas Metzger edited this page 2018-03-30 13:44:05 +02:00

Domains

Get list of domains

GET /records?page=5&pagesize=10&domain=1,2,3,4&queryName=foo&type=NS,SRV,A&queryContent=bar&sort=id-asc,name-desc,type-asc,content-asc,priority-desc,ttl-asc

parameter explanation
page The page of the results to return, if ommited returns page 1
pagesize How many items should be on each page, if ommited page size is infinite therefore all results are returned
domain A comma separated list of domain ids from which records should be returned, if omitted all records accessible by this user are returned
queryName A search query on the record name
type A comma separated list of record types (case insensitive)
queryContent A search query on the record content
sort A comma separated list of field names to sort (in this order) combined with the sort order (see example)

Response

code result
200 Everything was successful
{
  "paging": {
    "page": 5,
    "total": 20,
    "pagesize": 10
  },
  "results": [
    {
      "id": 1,
      "name": "dns.example.com",
      "type": "A",
      "content": "1.2.3.4",
      "priority": 0,
      "ttl": 86400,
      "domain": 1
    }
  ]
}

Create new record

POST /records

Body

{
  "name": "dns.example.com",
  "type": "A",
  "content": "1.2.3.4",
  "priority": 0,
  "ttl": 86400,
  "domain": 1
}

Response

code result
201 Everything was successful, record has been created
400 Given record type is not valid
404 Given domain does not exist or is not master or native
422 One of the required fields is missing
{
  "id": 21,
  "name": "dns.example.com",
  "type": "A",
  "content": "1.2.3.4",
  "priority": 0,
  "ttl": 86400,
  "domain": 1
}

Delete record

DELETE /records/{id}

Response

code result
204 Everything was successful, the answer body is therefore empty
404 The given record id does not exist

Get single record

GET /record/{id}

Response

code result
200 Call was successful
404 The given record id does not exist
{
  "id": 21,
  "name": "dns.example.com",
  "type": "A",
  "content": "1.2.3.4",
  "priority": 0,
  "ttl": 86400,
  "domain": 1
}

Update record

PUT /records/{id}

Not set properties will not be updated.

Body

{
  "name?": "dns.example.com",
  "type?": "A",
  "content?": "1.2.3.4",
  "priority?": 0,
  "ttl?": 86400
}

Response

code result
204 Everything was successful, the answer body is therefore empty
400 Given record type is not valid
404 The given domain id does not exist