From 81001b562c0a43bdfa7a31973296419fbbc7f05b Mon Sep 17 00:00:00 2001 From: netbirddev Date: Mon, 23 Dec 2024 17:49:49 +0000 Subject: [PATCH] Update API pages with v0.35.0 --- src/pages/ipa/resources/accounts.mdx | 16 + src/pages/ipa/resources/groups.mdx | 184 ++ src/pages/ipa/resources/networks.mdx | 3422 ++++++++++++++++++++++++++ src/pages/ipa/resources/peers.mdx | 6 + src/pages/ipa/resources/policies.mdx | 332 ++- 5 files changed, 3934 insertions(+), 26 deletions(-) create mode 100644 src/pages/ipa/resources/networks.mdx diff --git a/src/pages/ipa/resources/accounts.mdx b/src/pages/ipa/resources/accounts.mdx index 74718e9a..939352aa 100644 --- a/src/pages/ipa/resources/accounts.mdx +++ b/src/pages/ipa/resources/accounts.mdx @@ -175,6 +175,7 @@ echo $response; "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -198,6 +199,7 @@ echo $response; "jwt_allow_groups": [ "string" ], + "routing_peer_dns_resolution_enabled": "boolean", "extra": { "peer_approval_enabled": "boolean" } @@ -444,6 +446,11 @@ echo $response; List of groups to which users are allowed access + + + + Enables or disables DNS resolution on the routing peers + @@ -493,6 +500,7 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \ "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -515,6 +523,7 @@ let data = JSON.stringify({ "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -559,6 +568,7 @@ payload = json.dumps({ "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -603,6 +613,7 @@ func main() { "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -665,6 +676,7 @@ request.body = JSON.dump({ "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -691,6 +703,7 @@ RequestBody body = RequestBody.create(mediaType, '{ "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -733,6 +746,7 @@ curl_setopt_array($curl, array( "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -770,6 +784,7 @@ echo $response; "jwt_allow_groups": [ "Administrators" ], + "routing_peer_dns_resolution_enabled": true, "extra": { "peer_approval_enabled": true } @@ -791,6 +806,7 @@ echo $response; "jwt_allow_groups": [ "string" ], + "routing_peer_dns_resolution_enabled": "boolean", "extra": { "peer_approval_enabled": "boolean" } diff --git a/src/pages/ipa/resources/groups.mdx b/src/pages/ipa/resources/groups.mdx index 55f9a841..cd7bcfd3 100644 --- a/src/pages/ipa/resources/groups.mdx +++ b/src/pages/ipa/resources/groups.mdx @@ -165,12 +165,19 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api", "peers": [ { "id": "chacbco6lnnbn6cg5s90", "name": "stage-host-1" } + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] } ] @@ -181,12 +188,19 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string", "peers": [ { "id": "string", "name": "string" } + ], + "resources": [ + { + "id": "string", + "type": "string" + } ] } ] @@ -217,6 +231,28 @@ echo $response; List of peers ids + + + +
+ More Information + + + + + ID of the resource + + + + + Network resource type based of the address + + + + + +
+
@@ -234,6 +270,12 @@ curl -X POST https://api.netbird.io/api/groups \ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }' ``` @@ -244,6 +286,12 @@ let data = JSON.stringify({ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }); let config = { @@ -276,6 +324,12 @@ payload = json.dumps({ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }) headers = { @@ -308,6 +362,12 @@ func main() { "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }`) client := &http.Client { @@ -358,6 +418,12 @@ request.body = JSON.dump({ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }) response = https.request(request) @@ -372,6 +438,12 @@ RequestBody body = RequestBody.create(mediaType, '{ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }'); Request request = new Request.Builder() @@ -402,6 +474,12 @@ curl_setopt_array($curl, array( "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }', CURLOPT_HTTPHEADER => array( @@ -426,12 +504,19 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api", "peers": [ { "id": "chacbco6lnnbn6cg5s90", "name": "stage-host-1" } + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] } ``` @@ -440,12 +525,19 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string", "peers": [ { "id": "string", "name": "string" } + ], + "resources": [ + { + "id": "string", + "type": "string" + } ] } ``` @@ -628,12 +720,19 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api", "peers": [ { "id": "chacbco6lnnbn6cg5s90", "name": "stage-host-1" } + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] } ``` @@ -642,12 +741,19 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string", "peers": [ { "id": "string", "name": "string" } + ], + "resources": [ + { + "id": "string", + "type": "string" + } ] } ``` @@ -685,6 +791,28 @@ echo $response; List of peers ids + + + +
+ More Information + + + + + ID of the resource + + + + + Network resource type based of the address + + + + + +
+
@@ -702,6 +830,12 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }' ``` @@ -712,6 +846,12 @@ let data = JSON.stringify({ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }); let config = { @@ -744,6 +884,12 @@ payload = json.dumps({ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }) headers = { @@ -776,6 +922,12 @@ func main() { "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }`) client := &http.Client { @@ -826,6 +978,12 @@ request.body = JSON.dump({ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }) response = https.request(request) @@ -840,6 +998,12 @@ RequestBody body = RequestBody.create(mediaType, '{ "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }'); Request request = new Request.Builder() @@ -870,6 +1034,12 @@ curl_setopt_array($curl, array( "name": "devs", "peers": [ "ch8i4ug6lnn4g9hqv7m1" + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] }', CURLOPT_HTTPHEADER => array( @@ -894,12 +1064,19 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api", "peers": [ { "id": "chacbco6lnnbn6cg5s90", "name": "stage-host-1" } + ], + "resources": [ + { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } ] } ``` @@ -908,12 +1085,19 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string", "peers": [ { "id": "string", "name": "string" } + ], + "resources": [ + { + "id": "string", + "type": "string" + } ] } ``` diff --git a/src/pages/ipa/resources/networks.mdx b/src/pages/ipa/resources/networks.mdx new file mode 100644 index 00000000..da44e1be --- /dev/null +++ b/src/pages/ipa/resources/networks.mdx @@ -0,0 +1,3422 @@ +export const title = 'Networks' + + + +## List all Networks {{ tag: 'GET' , label: '/api/networks' }} + + + + Returns a list of all networks + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/networks \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/networks', + 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/networks" + +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/networks" + 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/networks") + +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/networks") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks', + 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": "chacdk86lnnboviihd7g", + "routers": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "routing_peers_count": 2, + "resources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "policies": [ + "ch8i4ug6lnn4g9hqv7m2" + ], + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" + } +] +``` +```json {{ title: 'Schema' }} +[ + { + "id": "string", + "routers": [ + "string" + ], + "routing_peers_count": "integer", + "resources": [ + "string" + ], + "policies": [ + "string" + ], + "name": "string", + "description": "string" + } +] +``` + + + + + + +--- + + +## Create a Network {{ tag: 'POST' , label: '/api/networks' }} + + + + Creates a Network + + #### Request-Body Parameters + + + + Network name + + + + + Network description + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X POST https://api.netbird.io/api/networks \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}); +let config = { + method: 'post', + maxBodyLength: Infinity, + url: '/api/networks', + 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/networks" +payload = json.dumps({ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}) +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/networks" + method := "POST" + + payload := strings.NewReader(`{ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}`) + 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/networks") + +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": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}) +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": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/networks") + .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/networks', + 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": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}', + 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": "chacdk86lnnboviihd7g", + "routers": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "routing_peers_count": 2, + "resources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "policies": [ + "ch8i4ug6lnn4g9hqv7m2" + ], + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "routers": [ + "string" + ], + "routing_peers_count": "integer", + "resources": [ + "string" + ], + "policies": [ + "string" + ], + "name": "string", + "description": "string" +} +``` + + + + + + +--- + + +## Retrieve a Network {{ tag: 'GET' , label: '/api/networks/{networkId}' }} + + + + Get information about a Network + + #### Path Parameters + + + + The unique identifier of a network + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/networks/{networkId} \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}', + 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/networks/{networkId}" + +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/networks/{networkId}" + 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/networks/{networkId}") + +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/networks/{networkId}") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}', + 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": "chacdk86lnnboviihd7g", + "routers": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "routing_peers_count": 2, + "resources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "policies": [ + "ch8i4ug6lnn4g9hqv7m2" + ], + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "routers": [ + "string" + ], + "routing_peers_count": "integer", + "resources": [ + "string" + ], + "policies": [ + "string" + ], + "name": "string", + "description": "string" +} +``` + + + + + + +--- + + +## Update a Network {{ tag: 'PUT' , label: '/api/networks/{networkId}' }} + + + + Update/Replace a Network + + #### Path Parameters + + + + The unique identifier of a network + + + + #### Request-Body Parameters + + + + Network name + + + + + Network description + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/networks/{networkId} \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}', + 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/networks/{networkId}" +payload = json.dumps({ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}) +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/networks/{networkId}" + method := "PUT" + + payload := strings.NewReader(`{ + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}`) + 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/networks/{networkId}") + +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": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}) +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": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/networks/{networkId}") + .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/networks/{networkId}', + 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": "Remote Network 1", + "description": "A remote network that needs to be accessed" +}', + 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": "chacdk86lnnboviihd7g", + "routers": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "routing_peers_count": 2, + "resources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "policies": [ + "ch8i4ug6lnn4g9hqv7m2" + ], + "name": "Remote Network 1", + "description": "A remote network that needs to be accessed" +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "routers": [ + "string" + ], + "routing_peers_count": "integer", + "resources": [ + "string" + ], + "policies": [ + "string" + ], + "name": "string", + "description": "string" +} +``` + + + + + + +--- + + +## Delete a Network {{ tag: 'DELETE' , label: '/api/networks/{networkId}' }} + + + + Delete a network + + #### Path Parameters + + + + The unique identifier of a network + + + + + + +```bash {{ title: 'cURL' }} +curl -X DELETE https://api.netbird.io/api/networks/{networkId} \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'delete', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}', + 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/networks/{networkId}" + +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/networks/{networkId}" + 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/networks/{networkId}") + +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/networks/{networkId}") + .method("DELETE") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}', + 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 Network Resources {{ tag: 'GET' , label: '/api/networks/{networkId}/resources' }} + + + + Returns a list of all resources in a network + + #### Path Parameters + + + + The unique identifier of a network + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/networks/{networkId}/resources \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/resources', + 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/networks/{networkId}/resources" + +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/networks/{networkId}/resources" + 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/networks/{networkId}/resources") + +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/networks/{networkId}/resources") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}/resources', + 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": "chacdk86lnnboviihd7g", + "type": "host", + "groups": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "resources_count": 5, + "issued": "api" + } + ], + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1" + } +] +``` +```json {{ title: 'Schema' }} +[ + { + "id": "string", + "type": "string", + "groups": [ + { + "id": "string", + "name": "string", + "peers_count": "integer", + "resources_count": "integer", + "issued": "string" + } + ], + "name": "string", + "description": "string", + "address": "string" + } +] +``` + + + + + + +--- + + +## Create a Network Resource {{ tag: 'POST' , label: '/api/networks/{networkId}/resources' }} + + + + Creates a Network Resource + + #### Path Parameters + + + + The unique identifier of a network + + + + #### Request-Body Parameters + + + + Network resource name + + + + + Network resource description + + + + + Network resource address (either a direct host like 1.1.1.1 or 1.1.1.1/32, or a subnet like 192.168.178.0/24, or domains like example.com and *.example.com) + + + + + Group IDs containing the resource + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X POST https://api.netbird.io/api/networks/{networkId}/resources \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}); +let config = { + method: 'post', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/resources', + 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/networks/{networkId}/resources" +payload = json.dumps({ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}) +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/networks/{networkId}/resources" + method := "POST" + + payload := strings.NewReader(`{ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}`) + 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/networks/{networkId}/resources") + +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": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}) +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": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/networks/{networkId}/resources") + .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/networks/{networkId}/resources', + 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": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}', + 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": "chacdk86lnnboviihd7g", + "type": "host", + "groups": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "resources_count": 5, + "issued": "api" + } + ], + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1" +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "type": "string", + "groups": [ + { + "id": "string", + "name": "string", + "peers_count": "integer", + "resources_count": "integer", + "issued": "string" + } + ], + "name": "string", + "description": "string", + "address": "string" +} +``` + + + + + + +--- + + +## Retrieve a Network Resource {{ tag: 'GET' , label: '/api/networks/{networkId}/resources/{resourceId}' }} + + + + Get information about a Network Resource + + #### Path Parameters + + + + The unique identifier of a network + + + + The unique identifier of a network resource + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/networks/{networkId}/resources/{resourceId} \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/resources/{resourceId}', + 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/networks/{networkId}/resources/{resourceId}" + +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/networks/{networkId}/resources/{resourceId}" + 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/networks/{networkId}/resources/{resourceId}") + +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/networks/{networkId}/resources/{resourceId}") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}/resources/{resourceId}', + 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": "chacdk86lnnboviihd7g", + "type": "host", + "groups": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "resources_count": 5, + "issued": "api" + } + ], + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1" +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "type": "string", + "groups": [ + { + "id": "string", + "name": "string", + "peers_count": "integer", + "resources_count": "integer", + "issued": "string" + } + ], + "name": "string", + "description": "string", + "address": "string" +} +``` + + + + + + +--- + + +## Update a Network Resource {{ tag: 'PUT' , label: '/api/networks/{networkId}/resources/{resourceId}' }} + + + + Update a Network Resource + + #### Path Parameters + + + + The unique identifier of a network + + + + The unique identifier of a resource + + + + #### Request-Body Parameters + + + + Network resource name + + + + + Network resource description + + + + + Network resource address (either a direct host like 1.1.1.1 or 1.1.1.1/32, or a subnet like 192.168.178.0/24, or domains like example.com and *.example.com) + + + + + Group IDs containing the resource + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/networks/{networkId}/resources/{resourceId} \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/resources/{resourceId}', + 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/networks/{networkId}/resources/{resourceId}" +payload = json.dumps({ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}) +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/networks/{networkId}/resources/{resourceId}" + method := "PUT" + + payload := strings.NewReader(`{ + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}`) + 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/networks/{networkId}/resources/{resourceId}") + +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": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}) +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": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/networks/{networkId}/resources/{resourceId}") + .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/networks/{networkId}/resources/{resourceId}', + 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": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1", + "groups": [ + "chacdk86lnnboviihd70" + ] +}', + 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": "chacdk86lnnboviihd7g", + "type": "host", + "groups": [ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "resources_count": 5, + "issued": "api" + } + ], + "name": "Remote Resource 1", + "description": "A remote resource inside network 1", + "address": "1.1.1.1" +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "type": "string", + "groups": [ + { + "id": "string", + "name": "string", + "peers_count": "integer", + "resources_count": "integer", + "issued": "string" + } + ], + "name": "string", + "description": "string", + "address": "string" +} +``` + + + + + + +--- + + +## Delete a Network Resource {{ tag: 'DELETE' , label: '/api/networks/{networkId}/resources/{resourceId}' }} + + + + Delete a network resource + + #### Path Parameters + + + + + + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X DELETE https://api.netbird.io/api/networks/{networkId}/resources/{resourceId} \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'delete', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/resources/{resourceId}', + 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/networks/{networkId}/resources/{resourceId}" + +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/networks/{networkId}/resources/{resourceId}" + 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/networks/{networkId}/resources/{resourceId}") + +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/networks/{networkId}/resources/{resourceId}") + .method("DELETE") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}/resources/{resourceId}', + 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 Network Routers {{ tag: 'GET' , label: '/api/networks/{networkId}/routers' }} + + + + Returns a list of all routers in a network + + #### Path Parameters + + + + The unique identifier of a network + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/networks/{networkId}/routers \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/routers', + 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/networks/{networkId}/routers" + +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/networks/{networkId}/routers" + 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/networks/{networkId}/routers") + +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/networks/{networkId}/routers") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}/routers', + 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": "chacdk86lnnboviihd7g", + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true + } +] +``` +```json {{ title: 'Schema' }} +[ + { + "id": "string", + "peer": "string", + "peer_groups": [ + "string" + ], + "metric": "integer", + "masquerade": "boolean" + } +] +``` + + + + + + +--- + + +## Create a Network Router {{ tag: 'POST' , label: '/api/networks/{networkId}/routers' }} + + + + Creates a Network Router + + #### Path Parameters + + + + The unique identifier of a network + + + + #### Request-Body Parameters + + + + Peer Identifier associated with route. This property can not be set together with `peer_groups` + + + + + Peers Group Identifier associated with route. This property can not be set together with `peer` + + + + + Route metric number. Lowest number has higher priority + + + + + Indicate if peer should masquerade traffic to this route's prefix + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X POST https://api.netbird.io/api/networks/{networkId}/routers \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}); +let config = { + method: 'post', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/routers', + 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/networks/{networkId}/routers" +payload = json.dumps({ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}) +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/networks/{networkId}/routers" + method := "POST" + + payload := strings.NewReader(`{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}`) + 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/networks/{networkId}/routers") + +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({ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}) +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, '{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/networks/{networkId}/routers") + .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/networks/{networkId}/routers', + 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 => '{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}', + 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": "chacdk86lnnboviihd7g", + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "peer": "string", + "peer_groups": [ + "string" + ], + "metric": "integer", + "masquerade": "boolean" +} +``` + + + + + + +--- + + +## Retrieve a Network Router {{ tag: 'GET' , label: '/api/networks/{networkId}/routers/{routerId}' }} + + + + Get information about a Network Router + + #### Path Parameters + + + + The unique identifier of a network + + + + The unique identifier of a router + + + + + + +```bash {{ title: 'cURL' }} +curl -X GET https://api.netbird.io/api/networks/{networkId}/routers/{routerId} \ +-H 'Accept: application/json' \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'get', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/routers/{routerId}', + 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/networks/{networkId}/routers/{routerId}" + +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/networks/{networkId}/routers/{routerId}" + 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/networks/{networkId}/routers/{routerId}") + +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/networks/{networkId}/routers/{routerId}") + .method("GET") + .addHeader("Accept", "application/json") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}/routers/{routerId}', + 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": "chacdk86lnnboviihd7g", + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "peer": "string", + "peer_groups": [ + "string" + ], + "metric": "integer", + "masquerade": "boolean" +} +``` + + + + + + +--- + + +## Update a Network Router {{ tag: 'PUT' , label: '/api/networks/{networkId}/routers/{routerId}' }} + + + + Update a Network Router + + #### Path Parameters + + + + The unique identifier of a network + + + + The unique identifier of a router + + + + #### Request-Body Parameters + + + + Peer Identifier associated with route. This property can not be set together with `peer_groups` + + + + + Peers Group Identifier associated with route. This property can not be set together with `peer` + + + + + Route metric number. Lowest number has higher priority + + + + + Indicate if peer should masquerade traffic to this route's prefix + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/networks/{networkId}/routers/{routerId} \ +-H 'Accept: application/json' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Token ' \ +--data-raw '{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}' +``` + +```js +const axios = require('axios'); +let data = JSON.stringify({ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/routers/{routerId}', + 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/networks/{networkId}/routers/{routerId}" +payload = json.dumps({ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}) +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/networks/{networkId}/routers/{routerId}" + method := "PUT" + + payload := strings.NewReader(`{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}`) + 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/networks/{networkId}/routers/{routerId}") + +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({ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}) +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, '{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/networks/{networkId}/routers/{routerId}") + .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/networks/{networkId}/routers/{routerId}', + 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 => '{ + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +}', + 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": "chacdk86lnnboviihd7g", + "peer": "chacbco6lnnbn6cg5s91", + "peer_groups": [ + "chacbco6lnnbn6cg5s91" + ], + "metric": 9999, + "masquerade": true +} +``` +```json {{ title: 'Schema' }} +{ + "id": "string", + "peer": "string", + "peer_groups": [ + "string" + ], + "metric": "integer", + "masquerade": "boolean" +} +``` + + + + + + +--- + + +## Delete a Network Router {{ tag: 'DELETE' , label: '/api/networks/{networkId}/routers/{routerId}' }} + + + + Delete a network router + + #### Path Parameters + + + + + + + + + + + + + + +```bash {{ title: 'cURL' }} +curl -X DELETE https://api.netbird.io/api/networks/{networkId}/routers/{routerId} \ +-H 'Authorization: Token ' +``` + +```js +const axios = require('axios'); + +let config = { + method: 'delete', + maxBodyLength: Infinity, + url: '/api/networks/{networkId}/routers/{routerId}', + 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/networks/{networkId}/routers/{routerId}" + +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/networks/{networkId}/routers/{routerId}" + 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/networks/{networkId}/routers/{routerId}") + +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/networks/{networkId}/routers/{routerId}") + .method("DELETE") + .addHeader("Authorization: Token ") + .build(); +Response response = client.newCall(request).execute(); +``` + +```php + 'https://api.netbird.io/api/networks/{networkId}/routers/{routerId}', + 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/peers.mdx b/src/pages/ipa/resources/peers.mdx index 27c7f5f6..d735c035 100644 --- a/src/pages/ipa/resources/peers.mdx +++ b/src/pages/ipa/resources/peers.mdx @@ -177,6 +177,7 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], @@ -215,6 +216,7 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], @@ -426,6 +428,7 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], @@ -461,6 +464,7 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], @@ -756,6 +760,7 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], @@ -791,6 +796,7 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], diff --git a/src/pages/ipa/resources/policies.mdx b/src/pages/ipa/resources/policies.mdx index fbcdff65..72369971 100644 --- a/src/pages/ipa/resources/policies.mdx +++ b/src/pages/ipa/resources/policies.mdx @@ -192,17 +192,27 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] } @@ -241,17 +251,27 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], + "sourceResource": { + "id": "string", + "type": "string" + }, "destinations": [ { "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } - ] + ], + "destinationResource": { + "id": "string", + "type": "string" + } } ] } @@ -367,15 +387,59 @@ echo $response; - + Policy rule source group IDs - + + +
+ More Information + + + + + ID of the resource + + + + + Network resource type based of the address + + + + + +
+ +
+ Policy rule destination group IDs + + + +
+ More Information + + + + + ID of the resource + + + + + Network resource type based of the address + + + + + +
+
@@ -424,9 +488,17 @@ curl -X POST https://api.netbird.io/api/policies \ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }' @@ -463,9 +535,17 @@ let data = JSON.stringify({ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }); @@ -524,9 +604,17 @@ payload = json.dumps({ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }) @@ -585,9 +673,17 @@ func main() { "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }`) @@ -664,9 +760,17 @@ request.body = JSON.dump({ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }) @@ -707,9 +811,17 @@ RequestBody body = RequestBody.create(mediaType, '{ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }'); @@ -766,9 +878,17 @@ curl_setopt_array($curl, array( "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }', @@ -821,17 +941,27 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] } @@ -868,17 +998,27 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], + "sourceResource": { + "id": "string", + "type": "string" + }, "destinations": [ { "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } - ] + ], + "destinationResource": { + "id": "string", + "type": "string" + } } ] } @@ -1089,17 +1229,27 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] } @@ -1136,17 +1286,27 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], + "sourceResource": { + "id": "string", + "type": "string" + }, "destinations": [ { "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } - ] + ], + "destinationResource": { + "id": "string", + "type": "string" + } } ] } @@ -1269,15 +1429,59 @@ echo $response;
- + Policy rule source group IDs - + + +
+ More Information + + + + + ID of the resource + + + + + Network resource type based of the address + + + + + +
+ +
+ Policy rule destination group IDs + + + +
+ More Information + + + + + ID of the resource + + + + + Network resource type based of the address + + + + + +
+
@@ -1326,9 +1530,17 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }' @@ -1365,9 +1577,17 @@ let data = JSON.stringify({ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }); @@ -1426,9 +1646,17 @@ payload = json.dumps({ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }) @@ -1487,9 +1715,17 @@ func main() { "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }`) @@ -1566,9 +1802,17 @@ request.body = JSON.dump({ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }) @@ -1609,9 +1853,17 @@ RequestBody body = RequestBody.create(mediaType, '{ "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }'); @@ -1668,9 +1920,17 @@ curl_setopt_array($curl, array( "sources": [ "ch8i4ug6lnn4g9hqv797" ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ "ch8i4ug6lnn4g9h7v7m0" - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] }', @@ -1723,17 +1983,27 @@ echo $response; "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } ], + "sourceResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + }, "destinations": [ { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "devs", "peers_count": 2, + "resources_count": 5, "issued": "api" } - ] + ], + "destinationResource": { + "id": "chacdk86lnnboviihd7g", + "type": "host" + } } ] } @@ -1770,17 +2040,27 @@ echo $response; "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } ], + "sourceResource": { + "id": "string", + "type": "string" + }, "destinations": [ { "id": "string", "name": "string", "peers_count": "integer", + "resources_count": "integer", "issued": "string" } - ] + ], + "destinationResource": { + "id": "string", + "type": "string" + } } ] }