import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/components/mdx"; export const title = 'DNS' ## List all Nameserver Groups {{ tag: 'GET' , label: '/api/dns/nameservers' }} Returns a list of all Nameserver Groups ```bash {{ title: 'cURL' }} curl -X GET https://api.netbird.io/api/dns/nameservers \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` ```js const axios = require('axios'); let config = { method: 'get', maxBodyLength: Infinity, url: '/api/dns/nameservers', headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/nameservers" headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("GET", url, headers=headers) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/nameservers" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return { req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/nameservers") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers") .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/nameservers', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} [ { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] } ] ``` ```json {{ title: 'Schema' }} [ { "id": "string", "name": "string", "description": "string", "nameservers": [ { "ip": "string", "ns_type": "string", "port": "integer" } ], "enabled": "boolean", "groups": [ "string" ], "primary": "boolean", "domains": [ "string" ] } ] ``` --- ## Create a Nameserver Group {{ tag: 'POST' , label: '/api/dns/nameservers' }} Creates a Nameserver Group #### Request-Body Parameters Nameserver group name Nameserver group description Nameserver group Nameserver group status Nameserver group tag groups Nameserver group primary status Nameserver group domain list ```bash {{ title: 'cURL' }} curl -X POST https://api.netbird.io/api/dns/nameservers \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }); let config = { method: 'post', maxBodyLength: Infinity, url: '/api/dns/nameservers', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Token ' }, data : data }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/nameservers" payload = json.dumps({ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }) headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/nameservers" method := "POST" payload := strings.NewReader(`{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return { req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/nameservers") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }) response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers") .method("POST", body) .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/nameservers', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] } ``` ```json {{ title: 'Schema' }} { "id": "string", "name": "string", "description": "string", "nameservers": [ { "ip": "string", "ns_type": "string", "port": "integer" } ], "enabled": "boolean", "groups": [ "string" ], "primary": "boolean", "domains": [ "string" ] } ``` --- ## Retrieve a Nameserver Group {{ tag: 'GET' , label: '/api/dns/nameservers/{nsgroupId}' }} Get information about a Nameserver Groups #### Path Parameters The unique identifier of a Nameserver Group ```bash {{ title: 'cURL' }} curl -X GET https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` ```js const axios = require('axios'); let config = { method: 'get', maxBodyLength: Infinity, url: '/api/dns/nameservers/{nsgroupId}', headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("GET", url, headers=headers) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return { req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/nameservers/{nsgroupId}', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] } ``` ```json {{ title: 'Schema' }} { "id": "string", "name": "string", "description": "string", "nameservers": [ { "ip": "string", "ns_type": "string", "port": "integer" } ], "enabled": "boolean", "groups": [ "string" ], "primary": "boolean", "domains": [ "string" ] } ``` --- ## Update a Nameserver Group {{ tag: 'PUT' , label: '/api/dns/nameservers/{nsgroupId}' }} Update/Replace a Nameserver Group #### Path Parameters The unique identifier of a Nameserver Group #### Request-Body Parameters Nameserver group name Nameserver group description Nameserver group Nameserver group status Nameserver group tag groups Nameserver group primary status Nameserver group domain list ```bash {{ title: 'cURL' }} curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }); let config = { method: 'put', maxBodyLength: Infinity, url: '/api/dns/nameservers/{nsgroupId}', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Token ' }, data : data }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" payload = json.dumps({ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }) headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" method := "PUT" payload := strings.NewReader(`{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return { req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }) response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") .method("PUT", body) .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/nameservers/{nsgroupId}', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "Google DNS", "description": "Google DNS servers", "nameservers": [ { "ip": "8.8.8.8", "ns_type": "udp", "port": 53 } ], "enabled": true, "groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "primary": true, "domains": [ "example.com" ] } ``` ```json {{ title: 'Schema' }} { "id": "string", "name": "string", "description": "string", "nameservers": [ { "ip": "string", "ns_type": "string", "port": "integer" } ], "enabled": "boolean", "groups": [ "string" ], "primary": "boolean", "domains": [ "string" ] } ``` --- ## Delete a Nameserver Group {{ tag: 'DELETE' , label: '/api/dns/nameservers/{nsgroupId}' }} Delete a Nameserver Group #### Path Parameters The unique identifier of a Nameserver Group ```bash {{ title: 'cURL' }} curl -X DELETE https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ -H 'Authorization: Token ' ``` ```js const axios = require('axios'); let config = { method: 'delete', maxBodyLength: Infinity, url: '/api/dns/nameservers/{nsgroupId}', headers: { 'Authorization': 'Token ' } }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" headers: { 'Authorization': 'Token ' } response = requests.request("DELETE", url, headers=headers) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" method := "DELETE" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return { req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") .method("DELETE") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/nameservers/{nsgroupId}', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => array( 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` --- ## Retrieve DNS Settings {{ tag: 'GET' , label: '/api/dns/settings' }} Returns a DNS settings object ```bash {{ title: 'cURL' }} curl -X GET https://api.netbird.io/api/dns/settings \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` ```js const axios = require('axios'); let config = { method: 'get', maxBodyLength: Infinity, url: '/api/dns/settings', headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/settings" headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("GET", url, headers=headers) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/settings" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return { req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/settings") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/settings") .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/settings', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} [ { "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] } ] ``` ```json {{ title: 'Schema' }} [ { "disabled_management_groups": [ "string" ] } ] ``` --- ## Update DNS Settings {{ tag: 'PUT' , label: '/api/dns/settings' }} Updates a DNS settings object #### Request-Body Parameters Groups whose DNS management is disabled ```bash {{ title: 'cURL' }} curl -X PUT https://api.netbird.io/api/dns/settings \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }); let config = { method: 'put', maxBodyLength: Infinity, url: '/api/dns/settings', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Token ' }, data : data }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/dns/settings" payload = json.dumps({ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }) headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/dns/settings" method := "PUT" payload := strings.NewReader(`{ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return { req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/dns/settings") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }) response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/settings") .method("PUT", body) .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/dns/settings', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} { "disabled_management_groups": [ "ch8i4ug6lnn4g9hqv7m0" ] } ``` ```json {{ title: 'Schema' }} { "disabled_management_groups": [ "string" ] } ``` ---