Manipulating zones is the primary use of the API.
GET
/servers/{server_id}/zones
¶List all Zones in a server
Parameters: |
|
---|---|
Query Parameters: | |
|
|
Status Codes: |
|
POST
/servers/{server_id}/zones
¶Creates a new domain, returns the Zone on creation.
Parameters: |
|
---|---|
Query Parameters: | |
|
|
Status Codes: |
|
GET
/servers/{server_id}/zones/{zone_id}
¶zone managed by a server
Parameters: |
|
---|---|
Query Parameters: | |
|
|
Status Codes: |
|
DELETE
/servers/{server_id}/zones/{zone_id}
¶Deletes this zone, all attached metadata and rrsets.
Parameters: |
|
---|---|
Status Codes: |
|
PATCH
/servers/{server_id}/zones/{zone_id}
¶Creates/modifies/deletes RRsets present in the payload and their comments. Returns 204 No Content on success.
Parameters: |
|
---|---|
Status Codes: |
|
PUT
/servers/{server_id}/zones/{zone_id}
¶Modifies basic zone data.
The only fields in the zone structure which can be modified are: kind, masters, catalog, account, soa_edit, soa_edit_api, api_rectify, dnssec, and nsec3param. All other fields are ignored.
Parameters: |
|
---|---|
Status Codes: |
|
PUT
/servers/{server_id}/zones/{zone_id}/axfr-retrieve
¶Retrieve slave zone from its master.
Fails when zone kind is not Slave, or slave is disabled in the configuration. Clients MUST NOT send a body.
Parameters: |
|
---|---|
Status Codes: |
|
PUT
/servers/{server_id}/zones/{zone_id}/notify
¶Send a DNS NOTIFY to all slaves.
Fails when zone kind is not Master or Slave, or master and slave are disabled in the configuration. Only works for Slave if renotify is on. Clients MUST NOT send a body.
Parameters: |
|
---|---|
Status Codes: |
|
GET
/servers/{server_id}/zones/{zone_id}/export
¶Returns the zone in AXFR format.
Parameters: |
|
---|---|
Status Codes: |
|
PUT
/servers/{server_id}/zones/{zone_id}/rectify
¶Rectify the zone data.
This does not take into account the API-RECTIFY metadata. Fails on slave zones and zones that do not have DNSSEC.
Parameters: |
|
---|---|
Status Codes: |
|
A Zone object represents an authoritative DNS Zone.
A Resource Record Set (below as “RRset”) are all records for a given name and type.
Comments are per-RRset.
Zone
¶This represents an authoritative DNS Zone.
Object Properties: | |
---|---|
|
RRSet
¶This represents a Resource Record Set (all records with the same name and type).
Object Properties: | |
---|---|
|
Record
¶The RREntry object represents a single record.
Object Properties: | |
---|---|
|
Comment
¶A comment about an RRSet.
Object Properties: | |
---|---|
|
Note
Switching dnssec
to true
(from false
) sets up DNSSEC signing
based on the other flags, this includes running the equivalent of
secure-zone
and rectify-zone
(if api_rectify
is set to true
).
This also applies to newly created zones. If presigned
is true
,
no DNSSEC changes will be made to the zone or cryptokeys.
Note
notified_serial
, serial
MUST NOT be sent in client bodies.
Changes made through the Zones API will always yield valid zone data, as the API will reject records with wrong data.
DNSSEC-enabled zones should be rectified after changing the zone data.
This can be done by the API automatically after a change when the API-RECTIFY metadata is set.
When creating or updating a zone, the “api_rectify” field of the Zone
can be set to true to enable this behaviour.
Backends might implement additional features (by coincidence or not). These things are not supported through the API.
When creating a slave zone, it is recommended to not set any of
nameservers
, rrsets
or zone
.
GET /api/v1/servers/localhost/zones HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
[{"account": "", "dnssec": false, "edited_serial": 2022040504, "id": "example.org.", "kind": "Native", "last_check": 0, "masters": [], "name": "example.org.", "notified_serial": 0, "serial": 2022040504, "url": "/api/v1/servers/localhost/zones/example.org."}]
POST /api/v1/servers/localhost/zones HTTP/1.1
X-API-Key: secret
Content-Type: application/json
{"name": "example.org.", "kind": "Native", "masters": [], "nameservers": ["ns1.example.org.", "ns2.example.org."]}
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
{"account": "", "api_rectify": false, "dnssec": false, "edited_serial": 2022040501, "id": "example.org.", "kind": "Native", "last_check": 0, "master_tsig_key_ids": [], "masters": [], "name": "example.org.", "notified_serial": 0, "nsec3narrow": false, "nsec3param": "", "rrsets": [{"comments": [], "name": "example.org.", "records": [{"content": "a.misconfigured.dns.server.invalid. hostmaster.example.org. 2022040501 10800 3600 604800 3600", "disabled": false}], "ttl": 3600, "type": "SOA"}, {"comments": [], "name": "example.org.", "records": [{"content": "ns1.example.org.", "disabled": false}, {"content": "ns2.example.org.", "disabled": false}], "ttl": 3600, "type": "NS"}], "serial": 2022040501, "slave_tsig_key_ids": [], "soa_edit": "", "soa_edit_api": "DEFAULT", "url": "/api/v1/servers/localhost/zones/example.org."}
GET /api/v1/servers/localhost/zones/example.org. HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
{"account": "", "api_rectify": false, "dnssec": false, "edited_serial": 2022040501, "id": "example.org.", "kind": "Native", "last_check": 0, "master_tsig_key_ids": [], "masters": [], "name": "example.org.", "notified_serial": 0, "nsec3narrow": false, "nsec3param": "", "rrsets": [{"comments": [], "name": "example.org.", "records": [{"content": "a.misconfigured.dns.server.invalid. hostmaster.example.org. 2022040501 10800 3600 604800 3600", "disabled": false}], "ttl": 3600, "type": "SOA"}, {"comments": [], "name": "example.org.", "records": [{"content": "ns1.example.org.", "disabled": false}, {"content": "ns2.example.org.", "disabled": false}], "ttl": 3600, "type": "NS"}], "serial": 2022040501, "slave_tsig_key_ids": [], "soa_edit": "", "soa_edit_api": "DEFAULT", "url": "/api/v1/servers/localhost/zones/example.org."}
DELETE /api/v1/servers/localhost/zones/example.org. HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 204 No Content
PATCH /api/v1/servers/localhost/zones/example.org. HTTP/1.1
X-API-Key: secret
Content-Type: application/json
{"rrsets": [{"name": "test.example.org.", "type": "A", "ttl": 3600, "changetype": "REPLACE", "records": [{"content": "192.168.0.5", "disabled": false}]}]}
Will yield a response similar to this (several headers omitted):
HTTP/1.1 204 No Content
PATCH /api/v1/servers/localhost/zones/example.org. HTTP/1.1
X-API-Key: secret
Content-Type: application/json
{"rrsets": [{"name": "test.example.org.", "type": "A", "changetype": "DELETE"}]}
Will yield a response similar to this (several headers omitted):
HTTP/1.1 204 No Content
PUT /api/v1/servers/localhost/zones/example.org./rectify HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
{"result": "Rectified"}