<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Please find the docs for 4.2.x at <a href="https://docs.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api" class="">https://docs.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api</a></div><div class=""><br class=""></div><div class="">In particular, note that the "masters" string must only be set if the type is Slave.</div><div class=""><br class=""></div><div class="">Regards,</div><div class=""><br class=""></div><div class="">Frank</div><div class=""><br class=""></div><div class=""><br class=""></div>On 30 Jun 2020, at 15:20, Tomasz Chmielewski <<a href="mailto:mangoo@wpkg.org" class="">mangoo@wpkg.org</a>> wrote:<div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="">I'm using pdns 4.2.1.<br class=""><br class=""><br class=""><br class="">Tomasz<br class=""><br class=""><br class="">On 2020-06-30 22:17, Frank Louwers wrote:<br class=""><blockquote type="cite" class="">Hi Tomasz,<br class="">What version are you using? The docs you mention, refer to an old<br class="">version of PowerDNS Auth...<br class="">Frank<br class=""><blockquote type="cite" class="">On 30 Jun 2020, at 15:09, Tomasz Chmielewski via Pdns-users<br class=""><<a href="mailto:pdns-users@mailman.powerdns.com" class="">pdns-users@mailman.powerdns.com</a>> wrote:<br class="">I did it exactly as in PowerDNS README:<br class=""><a href="https://doc.powerdns.com/md/httpapi/README/" class="">https://doc.powerdns.com/md/httpapi/README/</a><br class="">Does it mean README is buggy?<br class="">But it also fails without "masters" attribute:<br class=""># echo '{"name":"example.org [1].", "kind": "Native", "nameservers":<br class="">["ns1.example.org [2].", "ns2.example.org [3]."]}' | jq<br class="">{<br class="">"name": "example.org [1].",<br class="">"kind": "Native",<br class="">"nameservers": [<br class="">"ns1.example.org [2].",<br class="">"ns2.example.org [3]."<br class="">]<br class="">}<br class="">Tomasz<br class="">On 2020-06-14 23:52, Kevin P. Fleming via Pdns-users wrote:<br class="">Have you doing this without specifying the 'masters' attribute at<br class="">all?<br class="">Native zones don't support masters, so it's possible that supplying<br class="">the attribute, even with an empty list, is causing a failure.<br class="">On Sun, Jun 14, 2020 at 9:29 AM Tomasz Chmielewski via Pdns-users<br class=""><pdns-users@mailman.powerdns.com> wrote:<br class="">Using 4.2.1, I'm getting "HTTP/1.1 422 Unprocessable Entity" when<br class="">trying<br class="">to create a zone as described on<br class="">https://doc.powerdns.com/md/httpapi/README/<br class="">What am I doing wrong?<br class="">'{"name":"example.org.", "kind": "Native", "masters": [],<br class="">"nameservers":<br class="">["ns1.example.org.", "ns2.example.org."]}' validates fine with jq:<br class=""># echo '{"name":"example.org.", "kind": "Native", "masters": [],<br class="">"nameservers": ["ns1.example.org.", "ns2.example.org."]}' | jq<br class="">{<br class="">"name": "example.org.",<br class="">"kind": "Native",<br class="">"masters": [],<br class="">"nameservers": [<br class="">"ns1.example.org.",<br class="">"ns2.example.org."<br class="">]<br class="">}<br class=""># curl -X POST --data '{"name":"example.org.", "kind": "Native",<br class="">"masters": [], "nameservers": ["ns1.example.org.",<br class="">"ns2.example.org."]}'<br class="">-v -H 'X-API-Key: my-key'<br class="">http://10.58.150.164:8081/api/v1/servers/localhost/zones<br class="">Note: Unnecessary use of -X or --request, POST is already inferred.<br class="">*   Trying 10.58.150.164:8081...<br class="">* TCP_NODELAY set<br class="">* Connected to 10.58.150.164 (10.58.150.164) port 8081 (#0)<br class=""><blockquote type="cite" class="">POST /api/v1/servers/localhost/zones HTTP/1.1<br class="">Host: 10.58.150.164:8081<br class="">User-Agent: curl/7.68.0<br class="">Accept: */*<br class="">X-API-Key: my-key<br class="">Content-Length: 113<br class="">Content-Type: application/x-www-form-urlencoded<br class=""></blockquote>* upload completely sent off: 113 out of 113 bytes<br class="">* Mark bundle as not supporting multiuse<br class="">< HTTP/1.1 422 Unprocessable Entity<br class="">< Access-Control-Allow-Origin: *<br class="">< Connection: close<br class="">< Content-Length: 50<br class="">< Content-Security-Policy: default-src 'self'; style-src 'self'<br class="">'unsafe-inline'<br class="">< Content-Type: application/json<br class="">< Server: PowerDNS/4.2.1<br class="">< X-Content-Type-Options: nosniff<br class="">< X-Frame-Options: deny<br class="">< X-Permitted-Cross-Domain-Policies: none<br class="">< X-Xss-Protection: 1; mode=block<br class=""><<br class="">* Closing connection 0<br class="">{"error": "Creating domain 'example.org.' failed"}<br class="">This logs:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Request details:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  POST params:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"name":"example.org.",<br class="">"kind":<br class="">"Native", "masters": [], "nameservers": ["ns1.example.org.",<br class="">"ns2.example.org."]}:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Headers:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   accept: */*<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   content-length: 113<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   content-type:<br class="">application/x-www-form-urlencoded<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   host: 10.58.150.164:8081<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   user-agent: curl/7.68.0<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   x-api-key: my-key<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Full body:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"name":"example.org.",<br class="">"kind":<br class="">"Native", "masters": [], "nameservers": ["ns1.example.org.",<br class="">"ns2.example.org."]}<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Handling request<br class="">"/api/v1/servers/localhost/zones"<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Result for<br class="">"/api/v1/servers/localhost/zones": 422, body length: 50<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Response details:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Headers:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   access-control-allow-origin:<br class="">*<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Connection: close<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Length: 50<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Security-Policy:<br class="">default-src 'self'; style-src 'self' 'unsafe-inline'<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Type:<br class="">application/json<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Server: PowerDNS/4.2.1<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-Content-Type-Options:<br class="">nosniff<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-Frame-Options: deny<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8<br class="">X-Permitted-Cross-Domain-Policies: none<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-XSS-Protection: 1;<br class="">mode=block<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Full body:<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"error": "Creating domain<br class="">'example.org.' failed"}<br class="">Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]<br class="">a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 10.58.150.164:39182 "POST<br class="">/api/v1/servers/localhost/zones HTTP/1.1" 422 423<br class="">Tomasz<br class="">_______________________________________________<br class="">Pdns-users mailing list<br class="">Pdns-users@mailman.powerdns.com<br class="">https://mailman.powerdns.com/mailman/listinfo/pdns-users<br class="">_______________________________________________<br class="">Pdns-users mailing list<br class="">Pdns-users@mailman.powerdns.com<br class="">https://mailman.powerdns.com/mailman/listinfo/pdns-users<br class=""></blockquote> _______________________________________________<br class="">Pdns-users mailing list<br class=""><a href="mailto:Pdns-users@mailman.powerdns.com" class="">Pdns-users@mailman.powerdns.com</a><br class="">https://mailman.powerdns.com/mailman/listinfo/pdns-users<br class="">Links:<br class="">------<br class="">[1] http://example.org<br class="">[2] http://ns1.example.org<br class="">[3] http://ns2.example.org<br class=""></blockquote></div></div></blockquote></div><br class=""></body></html>