[Pdns-users] How to create zone via API?
Otto Moerbeek
otto at drijf.net
Mon Apr 1 18:01:42 UTC 2024
On Mon, Apr 01, 2024 at 04:57:08PM +0700, Bino Oetomo via Pdns-users wrote:
> Dear All.
>
> I'm trying to playing with PDNS API.
>
> I try to create new zone.
>
> The json payload is :
> ```
> {
> "name": "domain07.bino.",
> "kind": "Native",
> "records": [
> {
> "content": "ns1.cpaneldev.bino. emailserver.bino. 2024040101
> 3600 1800 1209600 86400",
> "ttl": 86400,
> "name": "domain07.bino",
> "type": "SOA"
> }
> ],
> }
> ```
A Zone object has no `records` member. It does have an `rrset` member,
which is an array of rssets. See
https://docs.powerdns.com/authoritative/http-api/zone.html#zone and
https://docs.powerdns.com/authoritative/http-api/zone.html#rrset
-Otto
>
> I post it to 'http://127.0.0.1:9530/api/v1/servers/localhost/zones'
> Got http status of 201.
>
> But when I check directly to mysql backend, I got :
> ```
> mysql> select * from records where domain_id = 41244;
> +---------+-----------+---------------+------+-----------------------------------------------------------------------------------------------+------+------+----------+-----------+------+
> | id | domain_id | name | type | content
> | ttl |
> prio | disabled | ordername | auth |
> +---------+-----------+---------------+------+-----------------------------------------------------------------------------------------------+------+------+----------+-----------+------+
> | 1065344 | 41244 | domain07.bino | SOA |
> a.misconfigured.dns.server.invalid hostmaster.domain07.bino 2024040101
> 10800 3600 604800 3600 | 3600 | 0 | 0 | NULL | 1 |
> +---------+-----------+---------------+------+-----------------------------------------------------------------------------------------------+------+------+----------+-----------+------+
> 1 row in set (0,00 sec)
>
> ```
>
> Kindly please tell me how to prepare proper json payload to create zone via
> pdns API
>
> regards
> -bino-
> _______________________________________________
> 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