From: Otto Moerbeek Date: Tue, 7 Nov 2023 08:26:23 +0000 (+0100) Subject: rec: provide two examples of zone manipulation is API docs X-Git-Tag: rec-5.0.0-rc1~38^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0a2615c7f988c8cf68b26fb04ef88d73ff3cfc4;p=thirdparty%2Fpdns.git rec: provide two examples of zone manipulation is API docs --- diff --git a/pdns/recursordist/docs/http-api/index.rst b/pdns/recursordist/docs/http-api/index.rst index b7e3efad46..941bcef161 100644 --- a/pdns/recursordist/docs/http-api/index.rst +++ b/pdns/recursordist/docs/http-api/index.rst @@ -47,6 +47,37 @@ And restart ``pdns_recursor``, the following examples should start working:: curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8082/api/v1/servers/localhost | jq . curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8082/api/v1/servers/localhost/zones | jq . +A few examples for zone manipulation follow, first one is to create a forwarding zone:: + + curl --no-progress-meter -H 'X-API-Key: changeme' -H 'Content-type: application/json' -X POST --data-binary @- http://localhost:8082/api/v1/servers/localhost/zones << EOF | jq + { + "name": "example.com.", + "type": "Zone", + "kind": "Forwarded", + "servers": ["192.168.178.1", "192.168.178.2:5353"], + "recursion_desired" : false + } + EOF + +Example output of the above command:: + + { + "id": "example.com.", + "kind": "Forwarded", + "name": "example.com.", + "records": [], + "recursion_desired": false, + "servers": [ + "192.168.178.1:53", + "192.168.178.2:5353" + ], + "url": "/api/v1/servers/localhost/zones/example.com." + } + +To delete the forwarding zone added above:: + + curl --no-progress-meter -H 'X-API-Key: changeme' -X DELETE http://localhost:8082/api/v1/servers/localhost/zones/example.com. + URL Endpoints ------------- diff --git a/pdns/recursordist/docs/http-api/zone.rst b/pdns/recursordist/docs/http-api/zone.rst index 4ff312afa3..b5420c2479 100644 --- a/pdns/recursordist/docs/http-api/zone.rst +++ b/pdns/recursordist/docs/http-api/zone.rst @@ -4,7 +4,7 @@ Zones Zone ---- -A Zone object represents an authoritative DNS Zone. +A Zone object represents an forward or authoritative DNS Zone. A Resource Record Set (below as "RRset") are all records for a given name and type.