2012 lines
131 KiB
JSON
2012 lines
131 KiB
JSON
{
|
|
"openapi": "3.0.1",
|
|
"info": {
|
|
"title": "Hetzner DNS Public API",
|
|
"description": "This is the public documentation Hetzner's DNS API.",
|
|
"contact": {
|
|
"name": "Hetzner Online GmbH",
|
|
"email": "support@hetzner.com"
|
|
},
|
|
"version": "1.1.1",
|
|
"x-logo": {
|
|
"url": "https://www.hetzner.com/themes/hetzner/images/logo/hetzner-logo.svg",
|
|
"altText": "Hetzner"
|
|
}
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://dns.hetzner.com/api/v1"
|
|
}
|
|
],
|
|
"tags": [
|
|
{
|
|
"name": "Zones",
|
|
"description": "A secondary zone can be created, by adding a primary server before adding any records."
|
|
},
|
|
{
|
|
"name": "Records",
|
|
"description": ""
|
|
},
|
|
{
|
|
"name": "Primary Servers",
|
|
"description": "Primary servers can only be added to a zone, if no records were added to it, yet. By adding a primary server to a newly created zone, it automatically becomes a secondary zone."
|
|
}
|
|
],
|
|
"paths": {
|
|
"/zones": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Get All Zones",
|
|
"description": "Returns paginated zones associated with the user. Limited to 100 zones per request.",
|
|
"operationId": "GetZones",
|
|
"parameters": [
|
|
{
|
|
"name": "name",
|
|
"in": "query",
|
|
"description": "Full name of a zone. Will return an array with one or no results",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"example": "example.com"
|
|
}
|
|
},
|
|
{
|
|
"name": "search_name",
|
|
"in": "query",
|
|
"description": "Partial name of a zone. Will return a maximum of 100 zones that contain the searched string",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"example": "example"
|
|
}
|
|
},
|
|
{
|
|
"name": "per_page",
|
|
"in": "query",
|
|
"description": "Number of zones to be shown per page. Returns 100 by default",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "number",
|
|
"default": 100,
|
|
"maximum": 100
|
|
}
|
|
},
|
|
{
|
|
"name": "page",
|
|
"in": "query",
|
|
"description": "A page parameter specifies the page to fetch.<br />The number of the first page is 1",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "number",
|
|
"minimum": 1,
|
|
"default": 1
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"zones": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/ZoneResponse"
|
|
}
|
|
},
|
|
"meta": {
|
|
"$ref": "#/components/schemas/Meta"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Pagination selectors are mutually exclusive"
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Get Zones\n# Returns all zones associated with the user.\ncurl \"https://dns.hetzner.com/api/v1/zones\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetZones() {\n\t// Get Zones (GET https://dns.hetzner.com/api/v1/zones)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Get Zones\n # GET https://dns.hetzner.com/api/v1/zones\n\n try:\n response = requests.get(\n url=\"https://dns.hetzner.com/api/v1/zones\",\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
]
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Create Zone",
|
|
"description": "Creates a new zone.",
|
|
"operationId": "CreateZone",
|
|
"parameters": [],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Zone"
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"zone": {
|
|
"$ref": "#/components/schemas/ZoneResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Create Zone\n# Creates a new zone.\ncurl -X \"POST\" \"https://dns.hetzner.com/api/v1/zones\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"name\": \"example.com\",\n \"ttl\": 86400\n}'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendCreateZone() {\n\t// Create Zone (POST https://dns.hetzner.com/api/v1/zones)\n\n\tjson := []byte(`{\"name\": \"example.com\",\"ttl\": 86400}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"POST\", \"https://dns.hetzner.com/api/v1/zones\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: application/json',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// json body\n$json_array = [\n 'name' => 'example.com',\n 'ttl' => 86400\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Create Zone\n # POST https://dns.hetzner.com/api/v1/zones\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/zones\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"name\": \"example.com\",\n \"ttl\": 86400\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
}
|
|
},
|
|
"/zones/{ZoneID}": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Get Zone",
|
|
"description": "Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.",
|
|
"operationId": "GetZone",
|
|
"parameters": [
|
|
{
|
|
"name": "ZoneID",
|
|
"in": "path",
|
|
"description": "ID of zone to get",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"zone": {
|
|
"$ref": "#/components/schemas/ZoneResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Get Zone\n# Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.\ncurl \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -H 'Content-Type: application/json; charset=utf-8'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetZone() {\n\t// Get Zone (GET https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones/{ZoneID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n 'Content-Type: application/json; charset=utf-8',\n]);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Get Zone\n # GET https://dns.hetzner.com/api/v1/zones/{ZoneID}\n\n try:\n response = requests.get(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}\",\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n \"Content-Type\": \"application/json; charset=utf-8\",\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
]
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Update Zone",
|
|
"description": "Updates a zone.",
|
|
"operationId": "UpdateZone",
|
|
"parameters": [
|
|
{
|
|
"name": "ZoneID",
|
|
"in": "path",
|
|
"description": "ID of zone to update",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Zone"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"zone": {
|
|
"$ref": "#/components/schemas/ZoneResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"409": {
|
|
"description": "Conflict"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Update Zone\n# Updates a zone.\ncurl -X \"PUT\" \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"name\": \"example.com\",\n \"ttl\": 86400\n}'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendUpdateZone() {\n\t// Update Zone (PUT https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\tjson := []byte(`{\"name\": \"example.com\",\"ttl\": 86400}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"PUT\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones/{ZoneID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: application/json',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// json body\n$json_array = [\n 'name' => 'example.com',\n 'ttl' => 86400\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Update Zone\n # PUT https://dns.hetzner.com/api/v1/zones/{ZoneID}\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"name\": \"example.com\",\n \"ttl\": 86400\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
},
|
|
"delete": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Delete Zone",
|
|
"description": "Deletes a zone.",
|
|
"operationId": "DeleteZone",
|
|
"parameters": [
|
|
{
|
|
"name": "ZoneID",
|
|
"in": "path",
|
|
"description": "ID of zone to be deleted",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response"
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Delete Zone\n# Deletes a zone.\ncurl -X \"DELETE\" \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendDeleteZone() {\n\t// Delete Zone (DELETE https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"DELETE\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones/{ZoneID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Delete Zone\n # DELETE https://dns.hetzner.com/api/v1/zones/{ZoneID}\n\n try:\n response = requests.delete(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}\",\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/zones/{ZoneID}/import": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"post": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Import Zone file plain",
|
|
"description": "Import a zone file in text/plain format.",
|
|
"operationId": "ImportZoneFilePlain",
|
|
"parameters": [
|
|
{
|
|
"name": "ZoneID",
|
|
"in": "path",
|
|
"description": "ID of zone to be imported",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "Zone file to import",
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Create",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"zone": {
|
|
"$ref": "#/components/schemas/ZoneResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Import Zone file plain\n# Import a zone file in text/plain format.\ncurl -X \"POST\" \"https://dns.hetzner.com/api/v1/zones/{ZoneID}/import\" \\\n -H 'Content-Type: text/plain' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'$ORIGIN example.com.\n$TTL 86400\ntest IN A 88.99.0.114\n@ IN SOA ns1.first-ns.de. dns.hetzner.com. 2019112800 86400 7200 3600000 3600'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc sendImportZoneFilePlain() {\n\t// Import Zone file plain (POST https://dns.hetzner.com/api/v1/zones/{ZoneID}/import)\n\n\tbody := strings.NewReader(`$ORIGIN example.com.\n$TTL 86400\ntest IN A 88.99.0.114\n@ IN SOA ns1.first-ns.de. dns.hetzner.com. 2019112800 86400 7200 3600000 3600`)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"POST\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}/import\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"text/plain\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones/{ZoneID}/import');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: text/plain',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// body string\n$body = '$ORIGIN example.com.\n$TTL 86400\ntest IN A 88.99.0.114\n@ IN SOA ns1.first-ns.de. dns.hetzner.com. 2019112800 86400 7200 3600000 3600';\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Import Zone file plain\n # POST https://dns.hetzner.com/api/v1/zones/{ZoneID}/import\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}/import\",\n headers={\n \"Content-Type\": \"text/plain\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=\"$ORIGIN example.com.\n$TTL 86400\ntest IN A 88.99.0.114\n@ IN SOA ns1.first-ns.de. dns.hetzner.com. 2019112800 86400 7200 3600000 3600\"\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
}
|
|
},
|
|
"/zones/{ZoneID}/export": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Export Zone file",
|
|
"description": "Export a zone file.",
|
|
"operationId": "ExportZoneFile",
|
|
"parameters": [
|
|
{
|
|
"name": "ZoneID",
|
|
"in": "path",
|
|
"description": "ID of zone to be exported",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string",
|
|
"description": "Zone file that was exported"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Export Zone file\n# Export a zone file.\ncurl \"https://dns.hetzner.com/api/v1/zones/{ZoneID}/export\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"bytes\"\n)\n\nfunc sendExportZoneFile() {\n\t// Export Zone file (GET https://dns.hetzner.com/api/v1/zones/{ZoneID}/export)\n\n\tparams := url.Values{}\n\tbody := bytes.NewBufferString(params.Encode())\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}/export\", body)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded; charset=utf-8\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones/{ZoneID}/export');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n 'Content-Type: application/x-www-form-urlencoded; charset=utf-8',\n]);\n\n// form body\n$body = [\n];\n$body = http_build_query($body);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Export Zone file\n # GET https://dns.hetzner.com/api/v1/zones/{ZoneID}/export\n\n try:\n response = requests.get(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}/export\",\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=utf-8\",\n },\n data={\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/zones/file/validate": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"post": {
|
|
"tags": [
|
|
"Zones"
|
|
],
|
|
"summary": "Validate Zone file plain",
|
|
"description": "Validate a zone file in text/plain format.",
|
|
"operationId": "ValidateZoneFilePlain",
|
|
"parameters": [],
|
|
"requestBody": {
|
|
"description": "Zone file to validate",
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"parsed_records": {
|
|
"type": "number"
|
|
},
|
|
"valid_records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Validate Zone file plain\n# Validate a zone file in text/plain format.\ncurl -X \"POST\" \"https://dns.hetzner.com/api/v1/zones/file/validate\" \\\n -H 'Content-Type: text/plain' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'$ORIGIN example.com.\n$TTL 86400\ntest IN A 88.99.0.114\n@ IN SOA ns1.first-ns.de. dns.hetzner.com. 2019112800 86400 7200 3600000 3600'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc sendImportZoneFilePlain() {\n\t// Import Zone file plain (POST https://dns.hetzner.com/api/v1/zones/file/validate)\n\n\tbody := strings.NewReader(`$ORIGIN example.com.\n$TTL 86400\ntest IN A 88.99.0.114\n@ IN SOA ns1.first-ns.de. dns.hetzner.com. 2019112800 86400 7200 3600000 3600`)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"POST\", \"https://dns.hetzner.com/api/v1/zones/file/validate\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"text/plain\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/zones/file/validate');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: text/plain',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// body string\n$body = '$ORIGIN example.com.\n$TTL 7200\n@ IN SOA shades06.rzone.de. postmaster.robot.first-ns.de. (\n 2019111200 ;serial\n 14400 ;refresh\n 1800 ;retry\n 604800 ;expire\n 86400) ;minimum\n \n@ IN NS ns3.second-ns.de\n@ IN NS ns.second-ns.com\n@ IN NS ns1.your-server.de\n\n@ IN A 188.40.28.2\n\nbustertest IN A 195.201.7.252\n\nmail IN A 188.40.28.2\n\nwww IN A 188.40.28.2\n\n@ IN AAAA 2a01:4f8:d0a:11f5::2\n\nmail IN AAAA 2a01:4f8:d0a:11f5::2\n\nwww IN AAAA 2a01:4f8:d0a:11f5::2';\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Validate Zone file plain\n # POST https://dns.hetzner.com/api/v1/zones/file/validate\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/zones/file/validate\",\n headers={\n \"Content-Type\": \"text/plain\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=\"$ORIGIN example.com.\n$TTL 7200\n@ IN SOA shades06.rzone.de. postmaster.robot.first-ns.de. (\n 2019111200 ;serial\n 14400 ;refresh\n 1800 ;retry\n 604800 ;expire\n 86400) ;minimum\n \n@ IN NS ns3.second-ns.de\n@ IN NS ns.second-ns.com\n@ IN NS ns1.your-server.de\n\n@ IN A 188.40.28.2\n\nbustertest IN A 195.201.7.252\n\nmail IN A 188.40.28.2\n\nwww IN A 188.40.28.2\n\n@ IN AAAA 2a01:4f8:d0a:11f5::2\n\nmail IN AAAA 2a01:4f8:d0a:11f5::2\n\nwww IN AAAA 2a01:4f8:d0a:11f5::2\"\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "ZoneFile"
|
|
}
|
|
},
|
|
"/records": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Get All Records",
|
|
"description": "Returns all records associated with user.",
|
|
"operationId": "GetRecords",
|
|
"parameters": [
|
|
{
|
|
"name": "zone_id",
|
|
"in": "query",
|
|
"description": "ID of zone",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "per_page",
|
|
"in": "query",
|
|
"description": "Number of records to be shown per page. Returns all by default",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
{
|
|
"name": "page",
|
|
"in": "query",
|
|
"description": "A page parameter specifies the page to fetch.<br />The number of the first page is 1",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "number",
|
|
"minimum": 1,
|
|
"default": 1
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Get Records\n# Returns all records associated with user.\ncurl \"https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetRecords() {\n\t// Get Records (GET https://dns.hetzner.com/api/v1/records?zone_id={ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\tparseFormErr := req.ParseForm()\n\tif parseFormErr != nil {\n\t fmt.Println(parseFormErr) \n\t}\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Get Records\n # GET https://dns.hetzner.com/api/v1/records\n\n try:\n response = requests.get(\n url=\"https://dns.hetzner.com/api/v1/records\",\n params={\n \"zone_id\": \"{ZoneID}\",\n },\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
]
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Create Record",
|
|
"description": "Creates a new record.",
|
|
"operationId": "CreateRecord",
|
|
"parameters": [],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Record"
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"record": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Create Record\n# Creates a new record.\ncurl -X \"POST\" \"https://dns.hetzner.com/api/v1/records\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"value\": \"1.1.1.1\",\n \"ttl\": 86400,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"1\"\n}'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendCreateRecord() {\n\t// Create Record (POST https://dns.hetzner.com/api/v1/records)\n\n\tjson := []byte(`{\"value\": \"1.1.1.1\",\"ttl\": 86400,\"type\": \"A\",\"name\": \"www\",\"zone_id\": \"1\"}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"POST\", \"https://dns.hetzner.com/api/v1/records\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: application/json',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// json body\n$json_array = [\n 'value' => '1.1.1.1',\n 'ttl' => 86400,\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => '1'\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Create Record\n # POST https://dns.hetzner.com/api/v1/records\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/records\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"value\": \"1.1.1.1\",\n \"ttl\": 86400,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"1\"\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
}
|
|
},
|
|
"/records/{RecordID}": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Get Record",
|
|
"description": "Returns information about a single record.",
|
|
"operationId": "GetRecord",
|
|
"parameters": [
|
|
{
|
|
"name": "RecordID",
|
|
"in": "path",
|
|
"description": "ID of record to get",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"record": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Get Record\n# Returns information about a single record.\ncurl \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetRecord() {\n\t// Get Record (GET https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records/{RecordID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Get Record\n # GET https://dns.hetzner.com/api/v1/records/{RecordID}\n\n try:\n response = requests.get(\n url=\"https://dns.hetzner.com/api/v1/records/{RecordID}\",\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
]
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Update Record",
|
|
"description": "Updates a record.",
|
|
"operationId": "UpdateRecord",
|
|
"parameters": [
|
|
{
|
|
"name": "RecordID",
|
|
"in": "path",
|
|
"description": "ID of record to be updated",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Record"
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"record": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"409": {
|
|
"description": "Conflict"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Update Record\n# Updates a record.\ncurl -X \"PUT\" \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"value\": \"1.1.1.2\",\n \"ttl\": 0,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n}'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendUpdateRecord() {\n\t// Update Record (PUT https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\tjson := []byte(`{\"value\": \"1.1.1.2\",\"ttl\": 0,\"type\": \"A\",\"name\": \"www\",\"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"PUT\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records/{RecordID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: application/json',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// json body\n$json_array = [\n 'value' => '1.1.1.2',\n 'ttl' => 0,\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => 'oH7shFebR6nLPgTnmvNjM8'\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Update Record\n # PUT https://dns.hetzner.com/api/v1/records/{RecordID}\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/records/{RecordID}\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"value\": \"1.1.1.2\",\n \"ttl\": 0,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
},
|
|
"delete": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Delete Record",
|
|
"description": "Deletes a record.",
|
|
"operationId": "DeleteRecord",
|
|
"parameters": [
|
|
{
|
|
"name": "RecordID",
|
|
"in": "path",
|
|
"description": "ID of record to delete",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response"
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Delete Record\n# Deletes a record.\ncurl -X \"DELETE\" \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendDeleteRecord() {\n\t// Delete Record (DELETE https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"DELETE\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records/{RecordID}');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\n\n\ndef send_request():\n # Delete Record\n # DELETE https://dns.hetzner.com/api/v1/records/{RecordID}\n\n try:\n response = requests.delete(\n url=\"https://dns.hetzner.com/api/v1/records/{RecordID}\",\n headers={\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/records/bulk": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"post": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Bulk Create Records",
|
|
"description": "Create several records at once.",
|
|
"operationId": "BulkCreateRecords",
|
|
"parameters": [],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Record"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
},
|
|
"valid_records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/BaseRecord"
|
|
}
|
|
},
|
|
"invalid_records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/BaseRecord"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Bulk Create Records\n# Create several records at once.\ncurl -X \"POST\" \"https://dns.hetzner.com/api/v1/records/bulk\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"records\": [\n {\n \"value\": \"81.169.145.141\",\n \"type\": \"A\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:5800::1141\",\n \"type\": \"AAAA\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.97\",\n \"type\": \"A\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:50f0::1097\",\n \"type\": \"AAAA\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20b:43:6653::506\",\n \"type\": \"AAAA\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"85.214.0.236\",\n \"type\": \"A\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"10 smtpin\",\n \"type\": \"MX\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.146.21\",\n \"type\": \"A\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:930:6653::d11\",\n \"type\": \"AAAA\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n }\n ]\n}'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendBulkCreateRecords() {\n\t// Bulk Create Records (POST https://dns.hetzner.com/api/v1/records/bulk)\n\n\tjson := []byte(`{\"records\": [{\"value\": \"81.169.145.141\",\"type\": \"A\",\"name\": \"autoconfig\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20a:202:5800::1141\",\"type\": \"AAAA\",\"name\": \"autoconfig\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"81.169.145.105\",\"type\": \"A\",\"name\": \"www\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20a:202:1105::\",\"type\": \"AAAA\",\"name\": \"www\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"81.169.145.105\",\"type\": \"A\",\"name\": \"cloud\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20a:202:1105::\",\"type\": \"AAAA\",\"name\": \"cloud\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"81.169.145.105\",\"type\": \"A\",\"name\": \"@\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20a:202:1105::\",\"type\": \"AAAA\",\"name\": \"@\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"81.169.145.97\",\"type\": \"A\",\"name\": \"smtpin\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20a:202:50f0::1097\",\"type\": \"AAAA\",\"name\": \"smtpin\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20b:43:6653::506\",\"type\": \"AAAA\",\"name\": \"shades06\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"85.214.0.236\",\"type\": \"A\",\"name\": \"shades06\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"10 smtpin\",\"type\": \"MX\",\"name\": \"@\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"81.169.146.21\",\"type\": \"A\",\"name\": \"docks11\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"},{\"value\": \"2a01:238:20a:930:6653::d11\",\"type\": \"AAAA\",\"name\": \"docks11\",\"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"}]}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"POST\", \"https://dns.hetzner.com/api/v1/records/bulk\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records/bulk');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: application/json',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// json body\n$json_array = [\n 'records' => [\n [\n 'value' => '81.169.145.141',\n 'type' => 'A',\n 'name' => 'autoconfig',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:5800::1141',\n 'type' => 'AAAA',\n 'name' => 'autoconfig',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => 'www',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => 'cloud',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => 'cloud',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.97',\n 'type' => 'A',\n 'name' => 'smtpin',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:50f0::1097',\n 'type' => 'AAAA',\n 'name' => 'smtpin',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20b:43:6653::506',\n 'type' => 'AAAA',\n 'name' => 'shades06',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '85.214.0.236',\n 'type' => 'A',\n 'name' => 'shades06',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '10 smtpin',\n 'type' => 'MX',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.146.21',\n 'type' => 'A',\n 'name' => 'docks11',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:930:6653::d11',\n 'type' => 'AAAA',\n 'name' => 'docks11',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ]\n ]\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Bulk Create Records\n # POST https://dns.hetzner.com/api/v1/records/bulk\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/records/bulk\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"records\": [\n {\n \"value\": \"81.169.145.141\",\n \"type\": \"A\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:5800::1141\",\n \"type\": \"AAAA\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.97\",\n \"type\": \"A\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:50f0::1097\",\n \"type\": \"AAAA\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20b:43:6653::506\",\n \"type\": \"AAAA\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"85.214.0.236\",\n \"type\": \"A\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"10 smtpin\",\n \"type\": \"MX\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.146.21\",\n \"type\": \"A\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:930:6653::d11\",\n \"type\": \"AAAA\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n }\n ]\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Records"
|
|
],
|
|
"summary": "Bulk Update Records",
|
|
"description": "Update several records at once.",
|
|
"operationId": "BulkUpdateRecords",
|
|
"parameters": [],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/RecordBulk"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/RecordResponse"
|
|
}
|
|
},
|
|
"failed_records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/BaseRecord"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"409": {
|
|
"description": "Conflict"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-code-samples": [
|
|
{
|
|
"lang": "cURL",
|
|
"source": "## Bulk Update Records\n# Update several records at once.\ncurl -X \"PUT\" \"https://dns.hetzner.com/api/v1/records/bulk\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"records\": [\n {\n \"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n },\n {\n \"id\": \"uuK5PKsmfvi7853g5wXfRa\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"mail\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"L5RawAt6pJrdhFacynLrVg\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n }\n ]\n}'\n"
|
|
},
|
|
{
|
|
"lang": "Go",
|
|
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendBulkUpdateRecords() {\n\t// Bulk Update Records (PUT https://dns.hetzner.com/api/v1/records/bulk)\n\n\tjson := []byte(`{\"records\": [{\"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"type\": \"AAAA\",\"name\": \"www\",\"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"},{\"id\": \"uuK5PKsmfvi7853g5wXfRa\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"mail\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"},{\"id\": \"L5RawAt6pJrdhFacynLrVg\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"cloud\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"},{\"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"@\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"}]}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"PUT\", \"https://dns.hetzner.com/api/v1/records/bulk\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n"
|
|
},
|
|
{
|
|
"lang": "PHP (cURL)",
|
|
"source": "<?php\n\n// get cURL resource\n$ch = curl_init();\n\n// set url\ncurl_setopt($ch, CURLOPT_URL, 'https://dns.hetzner.com/api/v1/records/bulk');\n\n// set method\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\n\n// return the transfer as a string\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n// set headers\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Content-Type: application/json',\n 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj',\n]);\n\n// json body\n$json_array = [\n 'records' => [\n [\n 'id' => 'mnsQmZmXXmWh5MpFeT67ZZ',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'type' => 'AAAA',\n 'name' => 'www',\n 'zone_id' => 'oH7shFebR6nLPgTnmvNjM8'\n ],\n [\n 'id' => 'uuK5PKsmfvi7853g5wXfRa',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => 'mail',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ],\n [\n 'id' => 'L5RawAt6pJrdhFacynLrVg',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => 'cloud',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ],\n [\n 'id' => 'HD3FZLUoxZQ2GpDCxPGEjY',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => '@',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ]\n ]\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n"
|
|
},
|
|
{
|
|
"lang": "Python",
|
|
"source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Bulk Update Records\n # PUT https://dns.hetzner.com/api/v1/records/bulk\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/records/bulk\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"records\": [\n {\n \"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n },\n {\n \"id\": \"uuK5PKsmfvi7853g5wXfRa\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"mail\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"L5RawAt6pJrdhFacynLrVg\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n }\n ]\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n"
|
|
}
|
|
],
|
|
"x-codegen-request-body-name": "body"
|
|
}
|
|
},
|
|
"/primary_servers": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Primary Servers"
|
|
],
|
|
"summary": "Get All Primary Servers",
|
|
"description": "Returns all primary servers associated with user. Primary servers can also be filtered by zone_id.",
|
|
"operationId": "GetPrimaryServers",
|
|
"parameters": [
|
|
{
|
|
"name": "zone_id",
|
|
"in": "query",
|
|
"description": "ID of zone",
|
|
"required": false,
|
|
"style": "form",
|
|
"explode": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"primary_servers": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/PrimaryServerResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Primary Servers"
|
|
],
|
|
"summary": "Create Primary Server",
|
|
"description": "Creates a new primary server.",
|
|
"operationId": "CreatePrimaryServer",
|
|
"parameters": [],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/PrimaryServer"
|
|
}
|
|
}
|
|
},
|
|
"required": false
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"primary_server": {
|
|
"$ref": "#/components/schemas/PrimaryServerResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-codegen-request-body-name": "body"
|
|
}
|
|
},
|
|
"/primary_servers/{PrimaryServerID}": {
|
|
"parameters": [
|
|
{
|
|
"name": "Auth-API-Token",
|
|
"in": "header",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"tags": [
|
|
"Primary Servers"
|
|
],
|
|
"summary": "Get Primary Server",
|
|
"description": "Returns an object containing all information of a primary server. Primary Server to get is identified by 'PrimaryServerID'.",
|
|
"operationId": "GetPrimaryServer",
|
|
"parameters": [
|
|
{
|
|
"name": "PrimaryServerID",
|
|
"in": "path",
|
|
"description": "ID of primary server to get",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"primary_server": {
|
|
"$ref": "#/components/schemas/PrimaryServerResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Primary Servers"
|
|
],
|
|
"summary": "Update Primary Server",
|
|
"description": "Updates a primary server.",
|
|
"operationId": "UpdatePrimaryServer",
|
|
"parameters": [
|
|
{
|
|
"name": "PrimaryServerID",
|
|
"in": "path",
|
|
"description": "ID of primaryServer to update",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/PrimaryServer"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"primary_server": {
|
|
"$ref": "#/components/schemas/PrimaryServerResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
},
|
|
"409": {
|
|
"description": "Conflict"
|
|
},
|
|
"422": {
|
|
"description": "Unprocessable entity"
|
|
}
|
|
},
|
|
"x-codegen-request-body-name": "body"
|
|
},
|
|
"delete": {
|
|
"tags": [
|
|
"Primary Servers"
|
|
],
|
|
"summary": "Delete Primary Server",
|
|
"description": "Deletes a primary server.",
|
|
"operationId": "DeletePrimaryServer",
|
|
"parameters": [
|
|
{
|
|
"name": "PrimaryServerID",
|
|
"in": "path",
|
|
"description": "ID of primary server to be deleted",
|
|
"required": true,
|
|
"style": "simple",
|
|
"explode": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response"
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized"
|
|
},
|
|
"403": {
|
|
"description": "Forbidden"
|
|
},
|
|
"404": {
|
|
"description": "Not found"
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"securitySchemes": {
|
|
"Auth-API-Token": {
|
|
"description": "You can create an API token in the DNS console.",
|
|
"type": "apiKey",
|
|
"name": "Auth-API-Token",
|
|
"in": "header"
|
|
}
|
|
},
|
|
"schemas": {
|
|
"BaseRecord": {
|
|
"properties": {
|
|
"zone_id": {
|
|
"type": "string",
|
|
"description": "ID of zone this record is associated with"
|
|
},
|
|
"type": {
|
|
"$ref": "#/components/schemas/RecordTypeCreatable"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of record"
|
|
},
|
|
"value": {
|
|
"type": "string",
|
|
"description": "Value of record (e.g. 127.0.0.1, 1.1.1.1)"
|
|
},
|
|
"ttl": {
|
|
"type": "integer",
|
|
"description": "TTL of record",
|
|
"format": "uint64"
|
|
}
|
|
}
|
|
},
|
|
"ExistingRecord": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/BaseRecord"
|
|
}
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "ID of record",
|
|
"readOnly": true
|
|
},
|
|
"created": {
|
|
"type": "string",
|
|
"description": "Time record was created",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
},
|
|
"modified": {
|
|
"type": "string",
|
|
"description": "Time record was last updated",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
},
|
|
"Record": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ExistingRecord"
|
|
}
|
|
],
|
|
"required": [
|
|
"name",
|
|
"type",
|
|
"value",
|
|
"zone_id"
|
|
]
|
|
},
|
|
"BaseRecordBulk": {
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "ID of record"
|
|
},
|
|
"zone_id": {
|
|
"type": "string",
|
|
"description": "ID of zone this record is associated with"
|
|
},
|
|
"type": {
|
|
"$ref": "#/components/schemas/RecordTypeCreatable"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of record"
|
|
},
|
|
"value": {
|
|
"type": "string",
|
|
"description": "Value of record (e.g. 127.0.0.1, 1.1.1.1)"
|
|
},
|
|
"ttl": {
|
|
"type": "integer",
|
|
"description": "TTL of record",
|
|
"format": "uint64"
|
|
}
|
|
}
|
|
},
|
|
"ExistingRecordBulk": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/BaseRecordBulk"
|
|
}
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "ID of record",
|
|
"readOnly": false
|
|
},
|
|
"created": {
|
|
"type": "string",
|
|
"description": "Time record was created",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
},
|
|
"modified": {
|
|
"type": "string",
|
|
"description": "Time record was last updated",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
},
|
|
"RecordBulk": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ExistingRecordBulk"
|
|
}
|
|
],
|
|
"required": [
|
|
"id",
|
|
"name",
|
|
"type",
|
|
"value",
|
|
"zone_id"
|
|
]
|
|
},
|
|
"RecordResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"$ref": "#/components/schemas/RecordType"
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ExistingRecord"
|
|
}
|
|
]
|
|
},
|
|
"BasePrimaryServer": {
|
|
"properties": {
|
|
"zone_id": {
|
|
"type": "string",
|
|
"description": "ID of zone this record is associated with"
|
|
},
|
|
"address": {
|
|
"type": "string",
|
|
"description": "IPv4 or IPv6 address of the primary server"
|
|
},
|
|
"port": {
|
|
"type": "integer",
|
|
"description": "Port number of the primary server",
|
|
"minimum": 1,
|
|
"maximum": 65535
|
|
}
|
|
}
|
|
},
|
|
"ExistingPrimaryServer": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/BasePrimaryServer"
|
|
}
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "ID of primary server",
|
|
"readOnly": true
|
|
},
|
|
"created": {
|
|
"type": "string",
|
|
"description": "Time primary server was created",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
},
|
|
"modified": {
|
|
"type": "string",
|
|
"description": "Time primary server was last updated",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
},
|
|
"PrimaryServer": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ExistingPrimaryServer"
|
|
}
|
|
],
|
|
"required": [
|
|
"id",
|
|
"address",
|
|
"port",
|
|
"zone_id"
|
|
]
|
|
},
|
|
"PrimaryServerResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"port": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 65535
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ExistingPrimaryServer"
|
|
}
|
|
]
|
|
},
|
|
"BaseZone": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "ID of zone",
|
|
"readOnly": true
|
|
},
|
|
"created": {
|
|
"type": "string",
|
|
"description": "Time zone was created",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
},
|
|
"modified": {
|
|
"type": "string",
|
|
"description": "Time zone was last updated",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
},
|
|
"legacy_dns_host": {
|
|
"type": "string",
|
|
"readOnly": true
|
|
},
|
|
"legacy_ns": {
|
|
"type": "array",
|
|
"readOnly": true,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of zone"
|
|
},
|
|
"ns": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"readOnly": true
|
|
},
|
|
"owner": {
|
|
"type": "string",
|
|
"description": "Owner of zone",
|
|
"readOnly": true
|
|
},
|
|
"paused": {
|
|
"type": "boolean",
|
|
"readOnly": true
|
|
},
|
|
"permission": {
|
|
"type": "string",
|
|
"description": "Zone's permissions",
|
|
"readOnly": true
|
|
},
|
|
"project": {
|
|
"type": "string",
|
|
"readOnly": true
|
|
},
|
|
"registrar": {
|
|
"type": "string",
|
|
"readOnly": true
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"description": "Status of zone",
|
|
"enum": [
|
|
"verified",
|
|
"failed",
|
|
"pending"
|
|
],
|
|
"readOnly": true
|
|
},
|
|
"ttl": {
|
|
"type": "integer",
|
|
"description": "TTL of zone",
|
|
"format": "uint64"
|
|
},
|
|
"verified": {
|
|
"type": "string",
|
|
"description": "Verification of zone",
|
|
"readOnly": true,
|
|
"format": "date-time"
|
|
},
|
|
"records_count": {
|
|
"type": "integer",
|
|
"description": "Amount of records associated to this zone",
|
|
"readOnly": true,
|
|
"format": "uint64"
|
|
},
|
|
"is_secondary_dns": {
|
|
"type": "boolean",
|
|
"description": "Indicates if a zone is a secondary DNS zone",
|
|
"readOnly": true
|
|
},
|
|
"txt_verification": {
|
|
"type": "object",
|
|
"description": "Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set",
|
|
"readOnly": true,
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of the TXT record",
|
|
"readOnly": true
|
|
},
|
|
"token": {
|
|
"type": "string",
|
|
"description": "Value of the TXT record",
|
|
"readOnly": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"Zone": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/BaseZone"
|
|
}
|
|
],
|
|
"required": [
|
|
"name"
|
|
]
|
|
},
|
|
"ZoneResponse": {
|
|
"type": "object",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/BaseZone"
|
|
}
|
|
]
|
|
},
|
|
"RecordTypeCreatable": {
|
|
"type": "string",
|
|
"enum": [
|
|
"A",
|
|
"AAAA",
|
|
"NS",
|
|
"MX",
|
|
"CNAME",
|
|
"RP",
|
|
"TXT",
|
|
"SOA",
|
|
"HINFO",
|
|
"SRV",
|
|
"DANE",
|
|
"TLSA",
|
|
"DS",
|
|
"CAA"
|
|
],
|
|
"description": "Type of the record"
|
|
},
|
|
"RecordType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"A",
|
|
"AAAA",
|
|
"PTR",
|
|
"NS",
|
|
"MX",
|
|
"CNAME",
|
|
"RP",
|
|
"TXT",
|
|
"SOA",
|
|
"HINFO",
|
|
"SRV",
|
|
"DANE",
|
|
"TLSA",
|
|
"DS",
|
|
"CAA"
|
|
],
|
|
"description": "Type of the record"
|
|
},
|
|
"Meta": {
|
|
"type": "object",
|
|
"description": "",
|
|
"properties": {
|
|
"pagination": {
|
|
"$ref": "#/components/schemas/Pagination"
|
|
}
|
|
}
|
|
},
|
|
"Pagination": {
|
|
"type": "object",
|
|
"description": "",
|
|
"properties": {
|
|
"page": {
|
|
"type": "number",
|
|
"description": "This value represents the current page",
|
|
"minimum": 1
|
|
},
|
|
"per_page": {
|
|
"type": "number",
|
|
"description": "This value represents the number of entries that are returned per page",
|
|
"minimum": 1
|
|
},
|
|
"last_page": {
|
|
"type": "number",
|
|
"description": "This value represents the last page",
|
|
"minimum": 1
|
|
},
|
|
"total_entries": {
|
|
"type": "number",
|
|
"description": "This value represents the total number of entries"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|