Webhosting: Hilfe & Tipps

Steht eine DNS API zur Verfügung?

Neben der Einrichtung und Verwaltung von DNS-Einträgen über Ihr Kundenmenü unter Domains, besteht ebenfalls die Möglichkeit unsere DNS API zu nutzen. Insofern Sie die DNS API nutzen möchten, muss zuvor ein Benutzerkonto für den Zugriff erstellt werden. Hierzu loggen Sie sich in Ihr Kundenmenü ein und rufen dort den Menüpunkt "Service" - "Einstellungen" - "Persönliche Daten" - "Accounts" auf. Richten Sie nun ein neues Benutzerkonto ein und wählen die Option "DNS API" aus. Im folgenden Dialogfenster erhalten Sie Ihren Benutzernamen, das Passwort sowie Ihren DNS API Key für den Zugriff auf die DNS API. 


Beispiele zur Nutzung:

 

acme.sh (Let's Encrypt):

PDNS_Url="https://login.udmedia.de/dns" PDNS_ServerId="udmedia" PDNS_Token="YOUR_API_KEY" acme.sh ...

 

lexicon

lexicon powerdns --auth-token YOUR_API_KEY --pdns-server https://login.udmedia.de/dns --pdns-server-id udmedia lexicon powerdns ...

oder

LEXICON_POWERDNS_TOKEN=YOUR_API_KEY LEXICON_POWERDNS_PDNS_SERVER=https://login.udmedia.de/dns LEXICON_POWERDNS_PDNS_SERVER_ID=udmedia lexicon powerdns ..

 


Dokumentation

Our DNS API is compatible with the PowerDNS HTTP API. In particular we have implemented the following endpoints.

Base URL

The base url is https://login.udmedia.de/dns/

Authentication

Pass the API key into the X-Api-Key header:

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://login.udmedia.de/dns/api/v1/servers/udmedia/zones'

List all Zones

GET {base_url}/api/v1/servers/udmedia/zones

Query Parameters:

zone (string) – When set to the name of a zone, only this zone is returned. If no zone with that name exists, the response is an empty array. This can e.g. be used to check if a zone exists in the database without having to guess/encode the zone’s id or to check if a zone exists.

Status Codes:

200 OK – An array of Zone objects
400 Bad Request – The supplied request was not valid
404 Not Found – Requested item was not found
422 Unprocessable Entity – The input to the operation was not valid
500 Internal Server Error – Internal server error

Example:

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://login.udmedia.de/dns/api/v1/servers/udmedia/zones'

[
    {
        "id": "example.com.",
        "url": "/dns/api/v1/servers/udmedia/zones/example.com.",
        "name": "example.com.",
        "type": "Zone",
        "kind": "Native",
        "dnssec": true,
        "account": null,
        "masters": [],
        "serial": 0,
        "notified_serial": 0
    },
    ...
]

Data of a specific zone, including the RRset

GET {base_url}/api/v1/servers/udmedia/zones/{zone_id}

Query Parameters:

rrsets (boolean) – "true" (default) or "false", whether to include the "rrsets" in the response Zone object.

Status Codes:

200 OK – A Zone
400 Bad Request – The supplied request was not valid
404 Not Found – Requested item was not found
422 Unprocessable Entity – The input to the operation was not valid
500 Internal Server Error – Internal server error

Example:

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://login.udmedia.de/dns/api/v1/servers/udmedia/zones/example.com.'
{
    "id": "example.com.",
    "url": "/api/public/api/v1/servers/udmedia/zones/example.com.",
    "name": "example.com.",
    "type": "Zone",
    "kind": "Native",
    "dnssec": true,
    "account": null,
    "masters": [],
    "serial": 2017031635,
    "notified_serial": 0,
    "rrsets": [
        {
            "name": "example.com.",
            "type": "SOA",
            "ttl": 3600,
            "comments": [],
            "records": [
                {
                    "disabled": false,
                    "content": "ns3.powerdns.de. technik@udmedia.de. 2017031635 10800 3600 1209600 3600"
                }
            ]
        },
        {
            "name": "example.com.",
            "type": "MX",
            "ttl": 3600,
            "comments": [],
            "records": [
                {
                    "disabled": false,
                    "content": "10 mail.zeus01.de."
                }
            ]
        },
        {
            "name": "example.com.",
            "type": "AAAA",
            "ttl": 3600,
            "comments": [],
            "records": [
                {
                    "disabled": false,
                    "content": "2a05:d580:0:1337::1f"
                }
            ]
        },
        {
            "name": "example.com.",
            "type": "A",
            "ttl": 3600,
            "comments": [],
            "records": [
                {
                    "disabled": false,
                    "content": "194.117.254.31"
                }
            ]
        },
        {
            "name": "*.example.com.",
            "type": "AAAA",
            "ttl": 3600,
            "comments": [],
            "records": [
                {
                    "disabled": false,
                    "content": "2a05:d580:0:1337::1f"
                }
            ]
        },
        {
            "name": "*.example.com.",
            "type": "A",
            "ttl": 3600,
            "comments": [],
            "records": [
                {
                    "disabled": false,
                    "content": "194.117.254.31"
                }
            ]
        }
    ]
}

Returns the zone in AXFR format

GET {base_url}/api/v1/servers/udmedia/zones/{zone_name}/export

Status Codes:

200 OK – OK
400 Bad Request – The supplied request was not valid
404 Not Found – Requested item was not found
422 Unprocessable Entity – The input to the operation was not valid
500 Internal Server Error – Internal server error

Example:

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://login.udmedia.de/dns/api/v1/servers/udmedia/zones/example.com./export'

example.com.      3600    SOA     ns3.powerdns.de. technik@udmedia.de. 2017031634 10800 3600 1209600 3600
example.com.      3600    NS      ns3.powerdns.de.
example.com.      3600    NS      ns4.powerdns.de.
example.com.      3600    MX      10 mail.zeus01.de.
example.com.      3600    AAAA    2a05:d580:0:1337::1f
example.com.      3600    A       194.117.254.31
*.example.com.    3600    AAAA    2a05:d580:0:1337::1f
*.example.com.    3600    A       194.117.254.31

Checks zone for possible errors

GET {base_url}/api/v1/servers/udmedia/zones/{zone_id}/check

Status Codes:

200 OK – Zone error object
400 Bad Request – The supplied request was not valid
404 Not Found – Requested item was not found
422 Unprocessable Entity – The input to the operation was not valid
500 Internal Server Error – Internal server error

Example:

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://login.udmedia.de/dns/api/v1/servers/udmedia/zones/example.com./check'

{
  "name": "example.com",
  "errors": ["CNAME 'mail.example.com' found, but other records with same label exist."],
  "warnings": []
}

Creates/modifies/deletes RRsets present in the payload and their comments

PATCH {base_url}/api/v1/servers/udmedia/zones/{zone_id}

Status Codes:

204 No Content – Returns 204 No Content on success.
400 Bad Request – The supplied request was not valid
404 Not Found – Requested item was not found
422 Unprocessable Entity – The input to the operation was not valid
500 Internal Server Error – Internal server error

Example:

curl -H 'X-Api-Key: YOUR_API_KEY' -X PATCH -d '{
  "id":"example.com.",
  "rrsets":[
    {
      "name":"foo.example.com.",
      "changetype":"REPLACE",
      "type":"A",
      "ttl":3600,
      "records":[ { "content":"127.0.0.2" } ] }
    ]
  }' 'https://login.udmedia.de/dns/api/v1/servers/udmedia/zones/example.com'

Zone object

This represents an authoritative DNS Zone.

Object Properties:

id (string) – Opaque zone id (string), assigned by the server, should not be interpreted by the application. Guaranteed to be safe for embedding in URLs.
name (string) – Name of the zone. MUST have a trailing dot
type (string) – Set to 'Zone'
url (string) – API endpoint for this zone
rrsets ([RRSet]) – RRSets in this zone (for zones/{zone_id} endpoint only; omitted during GET on the .../zones list endpoint)
kind (string) – Set to 'Native'
serial (integer) – Set to 0
notified_serial (integer) – Set to 0
masters ([string]) – Empty list
dnssec (boolean) – Whether or not this zone is DNSSEC signed
account (string) – Set to null

RRSet Object

This represents a Resource Record Set (all records with the same name and type).

Object Properties:

name (string) – Name for record set (e.g. "www.example.com.")
type (string) – Type of this record (e.g. "A", "PTR", "MX")
ttl (integer) – DNS TTL of the records, in seconds. MUST NOT be included when changetype is set to "DELETE".
changetype (string) – MUST be added when updating the RRSet. Must be REPLACE or DELETE. With DELETE, all existing RRs matching name and type will be deleted, including all comments. With REPLACE: when records is present, all existing RRs matching name and type will be deleted, and then new records given in records will be created. If no records are left, any existing comments will be deleted as well. When comments is present, all existing comments for the RRs matching name and type will be deleted, and then new comments given in comments will be created.
records ([Record]) – All records in this RRSet. When updating Records, this is the list of new records (replacing the old ones). Must be empty when changetype is set to DELETE. An empty list results in deletion of all records (and comments).
comments ([Comment]) – List of Comment. Always empty.

Record object

The RREntry object represents a single record.

Object Properties:

content (string) – The content of this record
disabled (boolean) – Whether or not this record is disabled. Always false.

Zone error object

Object Properties:

name (string) – Name of the zone. MUST have a trailing dot
errors ([string]) – List of zone errors. The zone or rrsets may not resolve correctly unless these errors are fixed.
warnings ([string]) – List of zone warnings.

Error object

Returned when the server encounters an error, either in client input or internally

Object Properties:

error (string) – A human readable error message
errors ([string]) – Optional array of multiple errors encountered during processing