]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: provide two examples of zone manipulation is API docs
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 7 Nov 2023 08:26:23 +0000 (09:26 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 8 Nov 2023 14:22:38 +0000 (15:22 +0100)
pdns/recursordist/docs/http-api/index.rst
pdns/recursordist/docs/http-api/zone.rst

index b7e3efad46d07de1c2e38d4f37c621aeae5ba746..941bcef161a2718a1c1ab6f33a91713193aa848c 100644 (file)
@@ -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
 -------------
 
index 4ff312afa3d1287d6bde244780348d48f60dd5d0..b5420c2479979bb82eaf2e84e6b87bceb9c1ca0f 100644 (file)
@@ -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.