-
Notifications
You must be signed in to change notification settings - Fork 49
API Domains
Lukas Metzger edited this page Apr 9, 2018
·
16 revisions
GET /domains?page=5&pagesize=10&query=foo&sort=id-asc,name-desc,type-asc,records-asc&type=MASTER
parameter | explanation |
---|---|
page | The page of the results to return, if omitted returns page 1 |
pagesize | How many items should be on each page, if omitted page size is infinite therefore all results are returned |
query | A search query |
sort | A comma separated list of field names to sort (in this order) combined with the sort order (see example) |
type | Filter for specific type, if omitted return all types |
code | result |
---|---|
200 | Everything was successful |
{
"paging": {
"page": 5,
"total": 20,
"pagesize": 10
},
"results": [
{
"id": 1,
"name": "example.com",
"type": "MASTER",
"records": 21
},
{
"id": 2,
"name": "example.com",
"type": "SLAVE",
"master": "12.34.56.78",
"records": 10
}
]
}
POST /domains
Note this won't create a SOA record for the domain, so it stays invalid until the SOA is set using the API below.
Can currently only be called by an admin user.
{
"name": "example.com",
"type": "MASTER"
}
Or for a slave zone:
{
"name": "example.com",
"type": "SLAVE",
"master": "12.34.56.78"
}
code | result |
---|---|
201 | Everything was successful, domain has been created |
400 | Type is invalid |
409 | A domain with that name already exists |
422 | One of the required fields is missing |
{
"id": 21,
"name": "example.com",
"type": "MASTER"
}
Or for a slave zone:
{
"id": 21,
"name": "example.com",
"type": "SLAVE",
"master": "12.34.56.78"
}
DELETE /domains/{id}
Can currently only be called by an admin user.
code | result |
---|---|
204 | Everything was successful, the answer body is therefore empty |
404 | The given domain id does not exist |
GET /domains/{id}
code | result |
---|---|
200 | Call was successful |
404 | The given domain id does not exist |
{
"id": 1,
"name": "example.com",
"type": "MASTER",
"records": 21
}
Or for a slave zone:
{
"id": 1,
"name": "example.com",
"type": "SLAVE",
"master": "12.34.56.78",
"records": 10
}
PUT /domains/{id}
This is only valid for slave zones to update the master. All other fields will be ignored.
User needs permission for the given domain.
{
"master": "1.2.3.4"
}
code | result |
---|---|
204 | Everything was successful, the answer body is therefore empty |
404 | The given domain id does not exist |
405 | The given domain is not a slave zone |
422 | One of the required fields is missing |
GET /domains/{id}/soa
Does not work for slave zones.
code | result |
---|---|
200 | Call was successful |
404 | The given domain id does not exist or has no SOA record |
{
"primary": "ns1.example.com",
"email": "[email protected]",
"refresh": 3600,
"retry": 900,
"expire": 604800,
"ttl": 86400,
"serial": 2017121801
}
PUT /domains/{id}/soa
Does not work for slave zones.
{
"primary": "ns1.example.com",
"email": "[email protected]",
"refresh": 3600,
"retry": 900,
"expire": 604800,
"ttl": 86400
}
code | result |
---|---|
204 | Everything was successful, the answer body is therefore empty |
404 | The given domain id does not exist |
405 | The given domain was not a master or a native zone |
422 | One of the required fields is missing |