The API accepts and emits JSON.
The Accept: header determines the output format. An unknown value or
*/* will cause a 400 Bad Request.
All text is UTF-8 and HTTP headers will reflect this.
Data types:
null but presentCollections generally support GET and POST with these meanings:
Retrieve a list of all entries.
The special type and url fields are included in the response
objects:
type: name of the resource typeurl: url to the objectResponse format:
[
obj1
[, further objs]
]
Example:
[
{
"type": "AType",
"id": "anid",
"url": "/atype/anid",
"a_field": "a_value"
},
{
"type": "AType",
"id": "anotherid",
"url": "/atype/anotherid",
"a_field": "another_value"
}
]
Create a new entry. The client has to supply the entry in the request body, in JSON format.
application/x-www-form-urlencoded data MUST NOT be sent.
Clients SHOULD not send the ‘url’ field.
Client body:
obj1
Example:
{
"type": "AType",
"id": "anewid",
"a_field": "anew_value"
}
200 OK201 Created, with new object as body.200 OK, with modified object as body. For some operations, 204 No Content is returned instead (and the modified object is not given in the body).200 OK, no body.For interactions that do not directly map onto CRUD, we use these:
200 OK200 OKAction/Execute methods return a JSON body of this format:
{
"message": "result message"
}
The PowerDNS daemons accept a static API Key, configured with the api-key option, which has to be sent in the X-API-Key header.
Response code 4xx or 5xx, depending on the situation. Never return 2xx for an error!
400 Bad Request400 Bad Request422 Unprocessable EntityError responses have a JSON body of this format:
{
"error": "short error message",
"errors": [
{ },
]
}
Where errors is optional, and the contents are error-specific.
Accept: header, or it was set to */*.zone_id URL part was invalid.
To get a valid zone_id, list the zones with the /api/v1/servers/:server_id/zones endpoint.