<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="">Hi Tomasz,<div class=""><br class=""></div><div class="">What version are you using? The docs you mention, refer to an old version of PowerDNS Auth...</div><div class=""><br class=""></div><div class="">Frank<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 30 Jun 2020, at 15:09, Tomasz Chmielewski via Pdns-users <<a href="mailto:pdns-users@mailman.powerdns.com" class="">pdns-users@mailman.powerdns.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I did it exactly as in PowerDNS README: <a href="https://doc.powerdns.com/md/httpapi/README/" class="">https://doc.powerdns.com/md/httpapi/README/</a><br class=""><br class="">Does it mean README is buggy?<br class=""><br class="">But it also fails without "masters" attribute:<br class=""><br class=""># echo '{"name":"<a href="http://example.org" class="">example.org</a>.", "kind": "Native", "nameservers": ["<a href="http://ns1.example.org" class="">ns1.example.org</a>.", "<a href="http://ns2.example.org" class="">ns2.example.org</a>."]}' | jq<br class="">{<br class=""> "name": "<a href="http://example.org" class="">example.org</a>.",<br class=""> "kind": "Native",<br class=""> "nameservers": [<br class=""> "<a href="http://ns1.example.org" class="">ns1.example.org</a>.",<br class=""> "<a href="http://ns2.example.org" class="">ns2.example.org</a>."<br class=""> ]<br class="">}<br class=""><br class=""><br class="">Tomasz<br class=""><br class=""><br class=""><br class=""><br class="">On 2020-06-14 23:52, Kevin P. Fleming via Pdns-users wrote:<br class=""><blockquote type="cite" class="">Have you doing this without specifying the 'masters' attribute at 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=""><<a href="mailto:pdns-users@mailman.powerdns.com" class="">pdns-users@mailman.powerdns.com</a>> wrote:<br class=""><blockquote type="cite" class="">Using 4.2.1, I'm getting "HTTP/1.1 422 Unprocessable Entity" when trying<br class="">to create a zone as described on<br class=""><a href="https://doc.powerdns.com/md/httpapi/README/" class="">https://doc.powerdns.com/md/httpapi/README/</a><br class="">What am I doing wrong?<br class="">'{"name":"example.org.", "kind": "Native", "masters": [], "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.", "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="">> 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="">><br class="">* 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.", "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.", "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="">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: 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: 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; 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=""></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=""></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=""></div></div></blockquote></div><br class=""></div></body></html>