Servers¶
The server endpoint is the ‘basis’ for all other API operations.
In the PowerDNS Authoritative Server, the server_id is always localhost.
However, the API is written in a way that a proxy could be in front of many servers, each with their own server_id.
Endpoints¶
- GET /servers¶
List all servers
Example request:
GET /servers HTTP/1.1 Host: example.com- Status Codes:¶
200 OK –
An array of servers
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ { "type": "string", "id": "string", "daemon_type": "string", "version": "string", "url": "string", "config_url": "string", "zones_url": "string" } ]default –
The input to the operation was not valid
Example response:
HTTP/1.1 default - Content-Type: application/json { "error": "string", "errors": [ "string" ] }
- GET /servers/{server_id}¶
List a server
- Parameters:¶
server_id (string) – The id of the server to retrieve
Example request:
GET /servers/{server_id} HTTP/1.1 Host: example.com- Status Codes:¶
200 OK –
An server
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "type": "string", "id": "string", "daemon_type": "string", "version": "string", "url": "string", "config_url": "string", "zones_url": "string" }default –
The input to the operation was not valid
Example response:
HTTP/1.1 default - Content-Type: application/json { "error": "string", "errors": [ "string" ] }
Objects¶
- json Server : object¶
Server
- Optional members:¶
- config_url : string¶
The API endpoint for this server’s configuration
- daemon_type : string¶
“recursor” for the PowerDNS Recursor and “authoritative” for the Authoritative Server
- id : string¶
The id of the server, “localhost”
- type : string¶
Set to “Server”
- url : string¶
The API endpoint for this server
- version : string¶
The version of the server software
- zones_url : string¶
The API endpoint for this server’s zones
Examples¶
Listing all servers¶
GET /api/v1/servers HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
[{"autoprimaries_url": "/api/v1/servers/localhost/autoprimaries{/autoprimary}", "config_url": "/api/v1/servers/localhost/config{/config_setting}", "daemon_type": "authoritative", "id": "localhost", "type": "Server", "url": "/api/v1/servers/localhost", "version": "4.6.1", "zones_url": "/api/v1/servers/localhost/zones{/zone}"}]
Listing a server¶
GET /api/v1/servers/localhost HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
{"autoprimaries_url": "/api/v1/servers/localhost/autoprimaries{/autoprimary}", "config_url": "/api/v1/servers/localhost/config{/config_setting}", "daemon_type": "authoritative", "id": "localhost", "type": "Server", "url": "/api/v1/servers/localhost", "version": "4.6.1", "zones_url": "/api/v1/servers/localhost/zones{/zone}"}