[Pdns-users] "HTTP/1.1 422 Unprocessable Entity" when creating a zone

Kevin Olbrich ko at sv01.de
Tue Jun 30 15:45:55 UTC 2020


Did you try to send your request without the last dot?
Like example.com instead if example.com. <--

Maybe I'm wrong but I noticed the same when I had to implement a sync
between PDNS and our management system.
I assumed I had to end all FQDNs by a dot but that's not the case with
PDNS (which is perfectly fine for me).

Kind regards
Kevin

Am Di., 30. Juni 2020 um 17:27 Uhr schrieb Tomasz Chmielewski via
Pdns-users <pdns-users at mailman.powerdns.com>:
>
> This type? https://docs.powerdns.com/authoritative/http-api/zone.html
>
> Objects
>
> A Zone object represents an authoritative DNS Zone.
>
> A Resource Record Set (below as “RRset”) are all records for a given
> name and type.
>
> type (string) – Set to “Zone”
>
>
> So let's see - nope, still error:
>
>
> # curl --data '{"name":"example.org.", "kind": "Native", "type": "Zone",
> "nameservers": ["ns1.example.org.", "ns2.example.org."]}' -v -H
> 'X-API-Key: eshie3aecokogaed8ahH6ga8goo2Ohphaequahgee1aizeo5fi'
> http://10.58.150.164:8081/api/v1/servers/localhost/zones
> *   Trying 10.58.150.164:8081...
> * TCP_NODELAY set
> * Connected to 10.58.150.164 (10.58.150.164) port 8081 (#0)
> > POST /api/v1/servers/localhost/zones HTTP/1.1
> > Host: 10.58.150.164:8081
> > User-Agent: curl/7.68.0
> > Accept: */*
> > X-API-Key: eshie3aecokogaed8ahH6ga8goo2Ohphaequahgee1aizeo5fi
> > Content-Length: 114
> > Content-Type: application/x-www-form-urlencoded
> >
> * upload completely sent off: 114 out of 114 bytes
> * Mark bundle as not supporting multiuse
> < HTTP/1.1 422 Unprocessable Entity
> < Access-Control-Allow-Origin: *
> < Connection: close
> < Content-Length: 50
> < Content-Security-Policy: default-src 'self'; style-src 'self'
> 'unsafe-inline'
> < Content-Type: application/json
> < Server: PowerDNS/4.2.1
> < X-Content-Type-Options: nosniff
> < X-Frame-Options: deny
> < X-Permitted-Cross-Domain-Policies: none
> < X-Xss-Protection: 1; mode=block
> <
> * Closing connection 0
> {"error": "Creating domain 'example.org.' failed"}
>
>
> Tomasz
>
>
>
> On 2020-07-01 00:17, Michael Loftis wrote:
> > On Tue, Jun 30, 2020 at 08:52 Tomasz Chmielewski via Pdns-users
> > <pdns-users at mailman.powerdns.com> wrote:
> >
> >> Unfortunately I'm not able to find what I'm doing wrong.
> >>
> >> The error is returned no matter if I have "master=yes" set in
> >> pdns.conf
> >> or not, and no matter if I use "masters": [] or not.
> >
> > Take a look at the object properties description at the bottom of the
> > documentation that Frank linked you. The documentation I know doesn't
> > include an example for zone creation. You're missing the type key. I
> > don't think that there are any other issues with the post data you're
> > sending. Just missing the type.
> >
> >> The query I'm sending:
> >>
> >> # curl --data '{"name":"example.org [1].", "kind": "Native",
> >> "nameservers":
> >> ["ns1.example.org [2].", "ns2.example.org [3]."]}' -v -H 'X-API-Key:
> >> my-api-key'
> >> http://10.58.150.164:8081/api/v1/servers/localhost/zones
> >> *   Trying 10.58.150.164:8081...
> >> * TCP_NODELAY set
> >> * Connected to 10.58.150.164 (10.58.150.164) port 8081 (#0)
> >>> POST /api/v1/servers/localhost/zones HTTP/1.1
> >>> Host: 10.58.150.164:8081 [4]
> >>> User-Agent: curl/7.68.0
> >>> Accept: */*
> >>> X-API-Key: my-api-key
> >>> Content-Length: 98
> >>> Content-Type: application/x-www-form-urlencoded
> >>>
> >> * upload completely sent off: 98 out of 98 bytes
> >> * Mark bundle as not supporting multiuse
> >> < HTTP/1.1 422 Unprocessable Entity
> >> < Access-Control-Allow-Origin: *
> >> < Connection: close
> >> < Content-Length: 50
> >> < Content-Security-Policy: default-src 'self'; style-src 'self'
> >> 'unsafe-inline'
> >> < Content-Type: application/json
> >> < Server: PowerDNS/4.2.1
> >> < X-Content-Type-Options: nosniff
> >> < X-Frame-Options: deny
> >> < X-Permitted-Cross-Domain-Policies: none
> >> < X-Xss-Protection: 1; mode=block
> >> <
> >> * Closing connection 0
> >> {"error": "Creating domain 'example.org [1].' failed"}
> >>
> >> Tomasz
> >>
> >> On 2020-06-30 22:38, Frank Louwers wrote:
> >>> Please find the docs for 4.2.x at
> >>>
> >>
> > https://docs.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api
> >>>
> >>> In particular, note that the "masters" string must only be set if
> >> the
> >>> type is Slave.
> >>>
> >>> Regards,
> >>>
> >>> Frank
> >>>
> >>> On 30 Jun 2020, at 15:20, Tomasz Chmielewski <mangoo at wpkg.org>
> >> wrote:
> >>>
> >>>> I'm using pdns 4.2.1.
> >>>>
> >>>> Tomasz
> >>>>
> >>>> On 2020-06-30 22:17, Frank Louwers wrote:
> >>>> Hi Tomasz,
> >>>> What version are you using? The docs you mention, refer to an old
> >>>> version of PowerDNS Auth...
> >>>> Frank
> >>>> On 30 Jun 2020, at 15:09, Tomasz Chmielewski via Pdns-users
> >>>> <pdns-users at mailman.powerdns.com> wrote:
> >>>> I did it exactly as in PowerDNS README:
> >>>> https://doc.powerdns.com/md/httpapi/README/
> >>>> Does it mean README is buggy?
> >>>> But it also fails without "masters" attribute:
> >>>> # echo '{"name":"example.org [1] [1].", "kind": "Native",
> >> "nameservers":
> >>>> ["ns1.example.org [2] [2].", "ns2.example.org [3] [3]."]}' | jq
> >>>> {
> >>>> "name": "example.org [1] [1].",
> >>>> "kind": "Native",
> >>>> "nameservers": [
> >>>> "ns1.example.org [2] [2].",
> >>>> "ns2.example.org [3] [3]."
> >>>> ]
> >>>> }
> >>>> Tomasz
> >>>> On 2020-06-14 23:52, Kevin P. Fleming via Pdns-users wrote:
> >>>> Have you doing this without specifying the 'masters' attribute at
> >>>> all?
> >>>> Native zones don't support masters, so it's possible that
> >> supplying
> >>>> the attribute, even with an empty list, is causing a failure.
> >>>> On Sun, Jun 14, 2020 at 9:29 AM Tomasz Chmielewski via Pdns-users
> >>>> <pdns-users at mailman.powerdns.com> wrote:
> >>>> Using 4.2.1, I'm getting "HTTP/1.1 422 Unprocessable Entity" when
> >>>> trying
> >>>> to create a zone as described on
> >>>> https://doc.powerdns.com/md/httpapi/README/
> >>>> What am I doing wrong?
> >>>> '{"name":"example.org [1].", "kind": "Native", "masters": [],
> >>>> "nameservers":
> >>>> ["ns1.example.org [2].", "ns2.example.org [3]."]}' validates fine
> >> with jq:
> >>>> # echo '{"name":"example.org [1].", "kind": "Native", "masters":
> >> [],
> >>>> "nameservers": ["ns1.example.org [2].", "ns2.example.org [3]."]}'
> >> | jq
> >>>> {
> >>>> "name": "example.org [1].",
> >>>> "kind": "Native",
> >>>> "masters": [],
> >>>> "nameservers": [
> >>>> "ns1.example.org [2].",
> >>>> "ns2.example.org [3]."
> >>>> ]
> >>>> }
> >>>> # curl -X POST --data '{"name":"example.org [1].", "kind":
> >> "Native",
> >>>> "masters": [], "nameservers": ["ns1.example.org [2].",
> >>>> "ns2.example.org [3]."]}'
> >>>> -v -H 'X-API-Key: my-key'
> >>>> http://10.58.150.164:8081/api/v1/servers/localhost/zones
> >>>> Note: Unnecessary use of -X or --request, POST is already
> >> inferred.
> >>>> *   Trying 10.58.150.164:8081...
> >>>> * TCP_NODELAY set
> >>>> * Connected to 10.58.150.164 (10.58.150.164) port 8081 (#0)
> >>>> POST /api/v1/servers/localhost/zones HTTP/1.1
> >>>> Host: 10.58.150.164:8081 [4]
> >>>> User-Agent: curl/7.68.0
> >>>> Accept: */*
> >>>> X-API-Key: my-key
> >>>> Content-Length: 113
> >>>> Content-Type: application/x-www-form-urlencoded
> >>>> * upload completely sent off: 113 out of 113 bytes
> >>>> * Mark bundle as not supporting multiuse
> >>>> < HTTP/1.1 422 Unprocessable Entity
> >>>> < Access-Control-Allow-Origin: *
> >>>> < Connection: close
> >>>> < Content-Length: 50
> >>>> < Content-Security-Policy: default-src 'self'; style-src 'self'
> >>>> 'unsafe-inline'
> >>>> < Content-Type: application/json
> >>>> < Server: PowerDNS/4.2.1
> >>>> < X-Content-Type-Options: nosniff
> >>>> < X-Frame-Options: deny
> >>>> < X-Permitted-Cross-Domain-Policies: none
> >>>> < X-Xss-Protection: 1; mode=block
> >>>> <
> >>>> * Closing connection 0
> >>>> {"error": "Creating domain 'example.org [1].' failed"}
> >>>> This logs:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Request details:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  POST params:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"name":"example.org
> >> [1].",
> >>>> "kind":
> >>>> "Native", "masters": [], "nameservers": ["ns1.example.org [2].",
> >>>> "ns2.example.org [3]."]}:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Headers:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   accept: */*
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   content-length: 113
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   content-type:
> >>>> application/x-www-form-urlencoded
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   host: 10.58.150.164:8081
> >> [4]
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   user-agent: curl/7.68.0
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   x-api-key: my-key
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Full body:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"name":"example.org
> >> [1].",
> >>>> "kind":
> >>>> "Native", "masters": [], "nameservers": ["ns1.example.org [2].",
> >>>> "ns2.example.org [3]."]}
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Handling request
> >>>> "/api/v1/servers/localhost/zones"
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Result for
> >>>> "/api/v1/servers/localhost/zones": 422, body length: 50
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Response details:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Headers:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8
> >> access-control-allow-origin:
> >>>> *
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Connection: close
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Length: 50
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Security-Policy:
> >>>> default-src 'self'; style-src 'self' 'unsafe-inline'
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Type:
> >>>> application/json
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Server: PowerDNS/4.2.1
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-Content-Type-Options:
> >>>> nosniff
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-Frame-Options: deny
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8
> >>>> X-Permitted-Cross-Domain-Policies: none
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-XSS-Protection: 1;
> >>>> mode=block
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Full body:
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"error": "Creating domain
> >>>> 'example.org [1].' failed"}
> >>>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
> >>>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 10.58.150.164:39182 [5]
> >> "POST
> >>>> /api/v1/servers/localhost/zones HTTP/1.1" 422 423
> >>>> Tomasz
> >>>> _______________________________________________
> >>>> Pdns-users mailing list
> >>>> Pdns-users at mailman.powerdns.com
> >>>> https://mailman.powerdns.com/mailman/listinfo/pdns-users
> >>>> _______________________________________________
> >>>> Pdns-users mailing list
> >>>> Pdns-users at mailman.powerdns.com
> >>>> https://mailman.powerdns.com/mailman/listinfo/pdns-users
> >>> _______________________________________________
> >>> Pdns-users mailing list
> >>> Pdns-users at mailman.powerdns.com
> >>> https://mailman.powerdns.com/mailman/listinfo/pdns-users
> >>> Links:
> >>> ------
> >>> [1] http://example.org
> >>> [2] http://ns1.example.org
> >>> [3] http://ns2.example.org
> >> _______________________________________________
> >> Pdns-users mailing list
> >> Pdns-users at mailman.powerdns.com
> >> https://mailman.powerdns.com/mailman/listinfo/pdns-users
> >  --
> >
> > "Genius might be described as a supreme capacity for getting its
> > possessors
> > into trouble of all kinds."
> > -- Samuel Butler
> >
> >
> > Links:
> > ------
> > [1] http://example.org
> > [2] http://ns1.example.org
> > [3] http://ns2.example.org
> > [4] http://10.58.150.164:8081
> > [5] http://10.58.150.164:39182
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-users


More information about the Pdns-users mailing list