From a7900b5b50c7569c143355d5b428308d4bd001c7 Mon Sep 17 00:00:00 2001 From: mlsmaycon Date: Fri, 23 Jan 2026 19:52:59 +0100 Subject: [PATCH 1/2] Update api.tsx to handle content type --- generator/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/api.ts b/generator/api.ts index 1bbf9ac0..a559ca35 100644 --- a/generator/api.ts +++ b/generator/api.ts @@ -135,7 +135,7 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string) { } var response = null - if(operation.responses["200"] != undefined && operation.responses["200"]["content"]["application/json"] != undefined) { + if(operation.responses["200"] != undefined && operation.responses["200"]["content"] != undefined && operation.responses["200"]["content"]["application/json"] != undefined) { response = { example: extractInfo(operation.responses["200"]["content"]["application/json"].schema, 'example'), schema: extractInfo(operation.responses["200"]["content"]["application/json"].schema, 'type') From 5df118431aa5c1b564bab51045f104d865e3188c Mon Sep 17 00:00:00 2001 From: netbirddev Date: Fri, 23 Jan 2026 18:57:15 +0000 Subject: [PATCH 2/2] Update API pages with v0.64.1 --- src/pages/ipa/resources/dns-zones.mdx | 2386 +++++++++++++++++++++++++ src/pages/ipa/resources/jobs.mdx | 863 +++++++++ src/pages/ipa/resources/peers.mdx | 803 +-------- src/pages/ipa/resources/users.mdx | 214 +++ 4 files changed, 3465 insertions(+), 801 deletions(-) create mode 100644 src/pages/ipa/resources/dns-zones.mdx create mode 100644 src/pages/ipa/resources/jobs.mdx diff --git a/src/pages/ipa/resources/dns-zones.mdx b/src/pages/ipa/resources/dns-zones.mdx new file mode 100644 index 00000000..64ba8555 --- /dev/null +++ b/src/pages/ipa/resources/dns-zones.mdx @@ -0,0 +1,2386 @@ +export const title = 'DNS Zones' + + + +## List all DNS Zones {{ tag: 'GET' , label: '/api/dns/zones' }} + + + + Returns a list of all custom DNS zones + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/dns/zones \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/dns/zones', + 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/zones" + +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/zones" + 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/zones") + +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/zones") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/dns/zones', + 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", + "records": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 + } + ], + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] + } +] +``` +```json {{ title: 'Schema' }} +[ + { + "id": "string", + "records": [ + { + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" + } + ], + "name": "string", + "domain": "string", + "enabled": "boolean", + "enable_search_domain": "boolean", + "distribution_groups": [ + "string" + ] + } +] +``` + + + + + + +--- + + +## Create a DNS Zone {{ tag: 'POST' , label: '/api/dns/zones' }} + + + + Creates a new custom DNS zone + + ### Request-Body Parameters + + + + Zone name identifier + + + + + Zone domain (FQDN) + + + + + Zone status + + + + + Enable this zone as a search domain + + + + + Group IDs that defines groups of peers that will resolve this zone + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X POST https://api.netbird.io/api/dns/zones \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}); +let config = { + method: 'post', + maxBodyLength: Infinity, + url: '/api/dns/zones', + 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/zones" +payload = json.dumps({ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}) +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/zones" + method := "POST" + + payload := strings.NewReader(`{ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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/zones") + +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": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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, '{ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/dns/zones") + .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/zones', + 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": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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' }} +{ + "id": "ch8i4ug6lnn4g9hqv7m0", + "records": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 + } + ], + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "records": [ + { + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" + } + ], + "name": "string", + "domain": "string", + "enabled": "boolean", + "enable_search_domain": "boolean", + "distribution_groups": [ + "string" + ] +} +``` + + + + + + +--- + + +## Retrieve a DNS Zone {{ tag: 'GET' , label: '/api/dns/zones/{zoneId}' }} + + + + Returns information about a specific DNS zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/dns/zones/{zoneId} \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}', + 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/zones/{zoneId}" + +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/zones/{zoneId}" + 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/zones/{zoneId}") + +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/zones/{zoneId}") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/dns/zones/{zoneId}', + 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", + "records": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 + } + ], + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "records": [ + { + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" + } + ], + "name": "string", + "domain": "string", + "enabled": "boolean", + "enable_search_domain": "boolean", + "distribution_groups": [ + "string" + ] +} +``` + + + + + + +--- + + +## Update a DNS Zone {{ tag: 'PUT' , label: '/api/dns/zones/{zoneId}' }} + + + + Updates a custom DNS zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + ### Request-Body Parameters + + + + Zone name identifier + + + + + Zone domain (FQDN) + + + + + Zone status + + + + + Enable this zone as a search domain + + + + + Group IDs that defines groups of peers that will resolve this zone + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/dns/zones/{zoneId} \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}', + 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/zones/{zoneId}" +payload = json.dumps({ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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/zones/{zoneId}" + method := "PUT" + + payload := strings.NewReader(`{ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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/zones/{zoneId}") + +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": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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, '{ + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/dns/zones/{zoneId}") + .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/zones/{zoneId}', + 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": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_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' }} +{ + "id": "ch8i4ug6lnn4g9hqv7m0", + "records": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 + } + ], + "name": "Office Zone", + "domain": "example.com", + "enabled": { + "description": "Zone status", + "type": "boolean", + "default": true + }, + "enable_search_domain": false, + "distribution_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "records": [ + { + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" + } + ], + "name": "string", + "domain": "string", + "enabled": "boolean", + "enable_search_domain": "boolean", + "distribution_groups": [ + "string" + ] +} +``` + + + + + + +--- + + +## Delete a DNS Zone {{ tag: 'DELETE' , label: '/api/dns/zones/{zoneId}' }} + + + + Deletes a custom DNS zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + + + +```bash {{ title: 'cURL' }} +curl -X DELETE https://api.netbird.io/api/dns/zones/{zoneId} \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'delete', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}', + 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/zones/{zoneId}" + +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/zones/{zoneId}" + 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/zones/{zoneId}") + +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/zones/{zoneId}") + .method("DELETE") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/dns/zones/{zoneId}', + 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; +``` + + + + + + + + +--- + + +## List all DNS Records {{ tag: 'GET' , label: '/api/dns/zones/{zoneId}/records' }} + + + + Returns a list of all DNS records in a zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/dns/zones/{zoneId}/records \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}/records', + 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/zones/{zoneId}/records" + +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/zones/{zoneId}/records" + 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/zones/{zoneId}/records") + +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/zones/{zoneId}/records") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/dns/zones/{zoneId}/records', + 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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 + } +] +``` +```json {{ title: 'Schema' }} +[ + { + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" + } +] +``` + + + + + + +--- + + +## Create a DNS Record {{ tag: 'POST' , label: '/api/dns/zones/{zoneId}/records' }} + + + + Creates a new DNS record in a zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + ### Request-Body Parameters + + + + FQDN for the DNS record. Must be a subdomain within or match the zone's domain. + + + + + DNS record type + + + + + DNS record content (IP address for A/AAAA, domain for CNAME) + + + + + Time to live in seconds + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X POST https://api.netbird.io/api/dns/zones/{zoneId}/records \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}); +let config = { + method: 'post', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}/records', + 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/zones/{zoneId}/records" +payload = json.dumps({ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}) +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/zones/{zoneId}/records" + method := "POST" + + payload := strings.NewReader(`{ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}`) + 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/zones/{zoneId}/records") + +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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}) +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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/dns/zones/{zoneId}/records") + .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/zones/{zoneId}/records', + 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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}', + 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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" +} +``` + + + + + + +--- + + +## Retrieve a DNS Record {{ tag: 'GET' , label: '/api/dns/zones/{zoneId}/records/{recordId}' }} + + + + Returns information about a specific DNS record + + ### Path Parameters + + + + The unique identifier of a zone + + + + The unique identifier of a DNS record + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/dns/zones/{zoneId}/records/{recordId} \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}/records/{recordId}', + 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/zones/{zoneId}/records/{recordId}" + +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/zones/{zoneId}/records/{recordId}" + 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/zones/{zoneId}/records/{recordId}") + +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/zones/{zoneId}/records/{recordId}") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/dns/zones/{zoneId}/records/{recordId}', + 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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" +} +``` + + + + + + +--- + + +## Update a DNS Record {{ tag: 'PUT' , label: '/api/dns/zones/{zoneId}/records/{recordId}' }} + + + + Updates a DNS record in a zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + The unique identifier of a DNS record + + + + ### Request-Body Parameters + + + + FQDN for the DNS record. Must be a subdomain within or match the zone's domain. + + + + + DNS record type + + + + + DNS record content (IP address for A/AAAA, domain for CNAME) + + + + + Time to live in seconds + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/dns/zones/{zoneId}/records/{recordId} \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}/records/{recordId}', + 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/zones/{zoneId}/records/{recordId}" +payload = json.dumps({ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}) +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/zones/{zoneId}/records/{recordId}" + method := "PUT" + + payload := strings.NewReader(`{ + "name": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}`) + 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/zones/{zoneId}/records/{recordId}") + +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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}) +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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/dns/zones/{zoneId}/records/{recordId}") + .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/zones/{zoneId}/records/{recordId}', + 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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +}', + 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": "www.example.com", + "type": "A", + "content": "192.168.1.1", + "ttl": 300 +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "name": "string", + "type": "string", + "content": "string", + "ttl": "integer" +} +``` + + + + + + +--- + + +## Delete a DNS Record {{ tag: 'DELETE' , label: '/api/dns/zones/{zoneId}/records/{recordId}' }} + + + + Deletes a DNS record from a zone + + ### Path Parameters + + + + The unique identifier of a zone + + + + The unique identifier of a DNS record + + + + + + +```bash {{ title: 'cURL' }} +curl -X DELETE https://api.netbird.io/api/dns/zones/{zoneId}/records/{recordId} \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'delete', + maxBodyLength: Infinity, + url: '/api/dns/zones/{zoneId}/records/{recordId}', + 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/zones/{zoneId}/records/{recordId}" + +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/zones/{zoneId}/records/{recordId}" + 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/zones/{zoneId}/records/{recordId}") + +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/zones/{zoneId}/records/{recordId}") + .method("DELETE") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/dns/zones/{zoneId}/records/{recordId}', + 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; +``` + + + + + + + + +--- diff --git a/src/pages/ipa/resources/jobs.mdx b/src/pages/ipa/resources/jobs.mdx new file mode 100644 index 00000000..37768c2f --- /dev/null +++ b/src/pages/ipa/resources/jobs.mdx @@ -0,0 +1,863 @@ +export const title = 'Jobs' + + + +## List Jobs {{ tag: 'GET' , label: '/api/peers/{peerId}/jobs' }} + + + + Retrieve all jobs for a given peer + + ### Path Parameters + + + + The unique identifier of a peer + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/peers/{peerId}/jobs \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/peers/{peerId}/jobs', + 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/peers/{peerId}/jobs" + +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/peers/{peerId}/jobs" + 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/peers/{peerId}/jobs") + +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/peers/{peerId}/jobs") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/peers/{peerId}/jobs', + 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": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "triggered_by": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "pending", + "succeeded", + "failed" + ] + }, + "failed_reason": { + "type": "string", + "nullable": true + }, + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + }, + "result": { + "upload_key": "upload_key_123" + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadResponse" + } + } + } + } +] +``` +```json {{ title: 'Schema' }} +[ + { + "id": "string", + "created_at": "string", + "completed_at": "string", + "triggered_by": "string", + "status": "string", + "failed_reason": "string", + "workload": { + "oneOf": [ + { + "type": "string", + "parameters": { + "bundle_for": "boolean", + "bundle_for_time": "integer", + "log_file_count": "integer", + "anonymize": "boolean" + }, + "result": { + "upload_key": "string" + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadResponse" + } + } + } + } +] +``` + + + + + + +--- + + +## Create Job {{ tag: 'POST' , label: '/api/peers/{peerId}/jobs' }} + + + + Create a new job for a given peer + + ### Path Parameters + + + + The unique identifier of a peer + + + + ### Request-Body Parameters + + + + + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X POST https://api.netbird.io/api/peers/{peerId}/jobs \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}); +let config = { + method: 'post', + maxBodyLength: Infinity, + url: '/api/peers/{peerId}/jobs', + 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/peers/{peerId}/jobs" +payload = json.dumps({ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}) +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/peers/{peerId}/jobs" + method := "POST" + + payload := strings.NewReader(`{ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}`) + 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/peers/{peerId}/jobs") + +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({ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}) +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, '{ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/peers/{peerId}/jobs") + .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/peers/{peerId}/jobs', + 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 => '{ + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadRequest" + } + } + } +}', + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Accept: application/json', + 'Authorization: Token ' + ), +)); + +$response = curl_exec($curl); + +curl_close($curl); +echo $response; +``` + + + + + + + + +--- + + +## Get Job {{ tag: 'GET' , label: '/api/peers/{peerId}/jobs/{jobId}' }} + + + + Retrieve details of a specific job + + ### Path Parameters + + + + The unique identifier of a peer + + + + The unique identifier of a job + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/peers/{peerId}/jobs/{jobId} \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/peers/{peerId}/jobs/{jobId}', + 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/peers/{peerId}/jobs/{jobId}" + +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/peers/{peerId}/jobs/{jobId}" + 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/peers/{peerId}/jobs/{jobId}") + +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/peers/{peerId}/jobs/{jobId}") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/peers/{peerId}/jobs/{jobId}', + 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": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "triggered_by": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "pending", + "succeeded", + "failed" + ] + }, + "failed_reason": { + "type": "string", + "nullable": true + }, + "workload": { + "oneOf": [ + { + "type": "bundle", + "parameters": { + "bundle_for": true, + "bundle_for_time": 2, + "log_file_count": 100, + "anonymize": false + }, + "result": { + "upload_key": "upload_key_123" + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadResponse" + } + } + } +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "created_at": "string", + "completed_at": "string", + "triggered_by": "string", + "status": "string", + "failed_reason": "string", + "workload": { + "oneOf": [ + { + "type": "string", + "parameters": { + "bundle_for": "boolean", + "bundle_for_time": "integer", + "log_file_count": "integer", + "anonymize": "boolean" + }, + "result": { + "upload_key": "string" + } + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "bundle": "#/components/schemas/BundleWorkloadResponse" + } + } + } +} +``` + + + + + + +--- diff --git a/src/pages/ipa/resources/peers.mdx b/src/pages/ipa/resources/peers.mdx index d3d19a96..a8667fb1 100644 --- a/src/pages/ipa/resources/peers.mdx +++ b/src/pages/ipa/resources/peers.mdx @@ -1597,807 +1597,8 @@ echo $response; } ``` - - - - - ---- - - -## Create Peer Debug Bundle Job {{ tag: 'POST' , label: '/api/peers/{peerId}/jobs' }} - - - - Triggers a remote debug bundle generation on the specified peer. The peer must be online and connected to receive - the job. Once generated, the bundle is automatically uploaded to the configured storage location. - - ### Path Parameters - - - - The unique identifier of a peer - - - - ### Request-Body Parameters - - - - The job workload configuration - - - - - #### Workload Object - - - - Job type. Use "bundle" for debug bundle generation - - - - - Job-specific parameters - - - - - #### Parameters Object (for debug bundle) - - - - Anonymize IP addresses and non-netbird.io domains in logs and status output (default: false) - - - - - Enable time-based log collection before generating bundle (default: false) - - - - - Duration in minutes for log collection (1-5 minutes). Only used if bundle_for is true - - - - - Number of log files to include (1-1000, default: 10) - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/peers/{peerId}/jobs \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/jobs', - 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/peers/{peerId}/jobs" -payload = json.dumps({ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": True, - "bundle_for": True, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}) -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/peers/{peerId}/jobs" - method := "POST" - - payload := strings.NewReader(`{ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}`) - 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/peers/{peerId}/jobs") - -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({ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}) -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, '{ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/peers/{peerId}/jobs") - .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/peers/{peerId}/jobs', - 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 => '{ - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -}', - 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": "chacbco6lnnbn6cg5s91", - "peer_id": "chacbco6lnnbn6cg5s90", - "status": "pending", - "created_at": "2026-01-21T10:30:00.000Z", - "updated_at": "2026-01-21T10:30:00.000Z", - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer_id": "string", - "status": "string", - "created_at": "string", - "updated_at": "string", - "workload": { - "type": "string", - "parameters": { - "anonymize": "boolean", - "bundle_for": "boolean", - "bundle_for_time": "number", - "log_file_count": "number" - }, - "result": { - "upload_key": "string" - } - } -} -``` - - - - - - ---- - - -## List Peer Jobs {{ tag: 'GET' , label: '/api/peers/{peerId}/jobs' }} - - - - Returns a list of all jobs for the specified peer, including debug bundle generation jobs. - - ### Path Parameters - - - - The unique identifier of a peer - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers/{peerId}/jobs \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/jobs', - 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/peers/{peerId}/jobs" - -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/peers/{peerId}/jobs" - 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/peers/{peerId}/jobs") - -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/peers/{peerId}/jobs") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}/jobs', - 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": "chacbco6lnnbn6cg5s91", - "peer_id": "chacbco6lnnbn6cg5s90", - "status": "succeeded", - "created_at": "2026-01-21T10:30:00.000Z", - "updated_at": "2026-01-21T10:31:15.000Z", - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - }, - "result": { - "upload_key": "1234567890ab27fb37c88b3b4be7011e22aa2e5ca6f38ffa9c4481884941f726/12345678-90ab-cdef-1234-567890abcdef" - } - } - }, - { - "id": "chacbco6lnnbn6cg5s92", - "peer_id": "chacbco6lnnbn6cg5s90", - "status": "pending", - "created_at": "2026-01-21T11:00:00.000Z", - "updated_at": "2026-01-21T11:00:00.000Z", - "workload": { - "type": "bundle", - "parameters": { - "anonymize": false, - "log_file_count": 10 - } - } - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "peer_id": "string", - "status": "string", - "created_at": "string", - "updated_at": "string", - "workload": { - "type": "string", - "parameters": { - "anonymize": "boolean", - "bundle_for": "boolean", - "bundle_for_time": "number", - "log_file_count": "number" - }, - "result": { - "upload_key": "string" - } - } - } -] -``` - - - - - - ---- - - -## Get Peer Job {{ tag: 'GET' , label: '/api/peers/{peerId}/jobs/{jobId}' }} - - - - Returns details of a specific job for the peer, including the upload key if the debug bundle generation is complete. - - ### Path Parameters - - - - The unique identifier of a peer - - - The unique identifier of a job - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers/{peerId}/jobs/{jobId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/jobs/{jobId}', - 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/peers/{peerId}/jobs/{jobId}" - -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/peers/{peerId}/jobs/{jobId}" - 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/peers/{peerId}/jobs/{jobId}") - -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/peers/{peerId}/jobs/{jobId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}/jobs/{jobId}', - 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": "chacbco6lnnbn6cg5s91", - "peer_id": "chacbco6lnnbn6cg5s90", - "status": "succeeded", - "created_at": "2026-01-21T10:30:00.000Z", - "updated_at": "2026-01-21T10:31:15.000Z", - "workload": { - "type": "bundle", - "parameters": { - "anonymize": true, - "bundle_for": true, - "bundle_for_time": 2, - "log_file_count": 10 - }, - "result": { - "upload_key": "1234567890ab27fb37c88b3b4be7011e22aa2e5ca6f38ffa9c4481884941f726/12345678-90ab-cdef-1234-567890abcdef" - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer_id": "string", - "status": "string", - "created_at": "string", - "updated_at": "string", - "workload": { - "type": "string", - "parameters": { - "anonymize": "boolean", - "bundle_for": "boolean", - "bundle_for_time": "number", - "log_file_count": "number" - }, - "result": { - "upload_key": "string" - } - } -} -``` - - - + + diff --git a/src/pages/ipa/resources/users.mdx b/src/pages/ipa/resources/users.mdx index 544e02f5..8c1ddebf 100644 --- a/src/pages/ipa/resources/users.mdx +++ b/src/pages/ipa/resources/users.mdx @@ -1706,6 +1706,220 @@ echo $response; --- +## Change user password {{ tag: 'PUT' , label: '/api/users/{userId}/password' }} + + + + Change the password for a user. Only available when embedded IdP is enabled. Users can only change their own password. + + ### Path Parameters + + + + The unique identifier of a user + + + + ### Request-Body Parameters + + + + The current password + + + + + The new password to set + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/users/{userId}/password \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/users/{userId}/password', + headers: { + '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/users/{userId}/password" +payload = json.dumps({ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}) +headers = { + 'Content-Type': '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/users/{userId}/password" + method := "PUT" + + payload := strings.NewReader(`{ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}`) + 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("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/users/{userId}/password") + +https = Net::HTTP.new(url.host, url.port) +https.use_ssl = true + +request = Net::HTTP::Put.new(url) +request["Content-Type"] = "application/json" +request["Authorization"] = "Token " + +request.body = JSON.dump({ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}) +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, '{ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/users/{userId}/password") + .method("PUT", body) + .addHeader("Content-Type", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/users/{userId}/password', + 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 => '{ + "old_password": "currentPassword123", + "new_password": "newSecurePassword456" +}', + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Authorization: Token ' + ), +)); + +$response = curl_exec($curl); + +curl_close($curl); +echo $response; +``` + + + + + + + + +--- + + ## Retrieve current user {{ tag: 'GET' , label: '/api/users/current' }}