diff --git a/src/pages/ipa/resources/accounts.mdx b/src/pages/ipa/resources/accounts.mdx deleted file mode 100644 index fcd770f6..00000000 --- a/src/pages/ipa/resources/accounts.mdx +++ /dev/null @@ -1,968 +0,0 @@ -export const title = 'Accounts' - - - -## List all Accounts {{ tag: 'GET' , label: '/api/accounts' }} - - - - Returns a list of accounts of a user. Always returns a list of one account. - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/accounts \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/accounts', - 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/accounts" - -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/accounts" - 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/accounts") - -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/accounts") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/accounts', - 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": "ch8i4ug6lnn4g9hqv7l0", - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "domain": "netbird.io", - "domain_category": "private", - "created_at": "2023-05-05T09:00:35.477782Z", - "created_by": "google-oauth2|277474792786460067937", - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "settings": { - "peer_login_expiration_enabled": "boolean", - "peer_login_expiration": "integer", - "peer_inactivity_expiration_enabled": "boolean", - "peer_inactivity_expiration": "integer", - "regular_users_view_blocked": "boolean", - "groups_propagation_enabled": "boolean", - "jwt_groups_enabled": "boolean", - "jwt_groups_claim_name": "string", - "jwt_allow_groups": [ - "string" - ], - "routing_peer_dns_resolution_enabled": "boolean", - "dns_domain": "string", - "extra": { - "peer_approval_enabled": "boolean", - "network_traffic_logs_enabled": "boolean", - "network_traffic_packet_counter_enabled": "boolean" - }, - "lazy_connection_enabled": "boolean" - }, - "domain": "string", - "domain_category": "string", - "created_at": "string", - "created_by": "string", - "onboarding": { - "signup_form_pending": "boolean", - "onboarding_flow_pending": "boolean" - } - } -] -``` - - - - - - ---- - - -## Delete an Account {{ tag: 'DELETE' , label: '/api/accounts/{accountId}' }} - - - - Deletes an account and all its resources. Only account owners can delete accounts. - - ### Path Parameters - - - - The unique identifier of an account - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/accounts/{accountId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/accounts/{accountId}', - 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/accounts/{accountId}" - -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/accounts/{accountId}" - 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/accounts/{accountId}") - -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/accounts/{accountId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/accounts/{accountId}', - 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; -``` - - - - - - - - ---- - - -## Update an Account {{ tag: 'PUT' , label: '/api/accounts/{accountId}' }} - - - - Update information about an account - - ### Path Parameters - - - - The unique identifier of an account - - - - ### Request-Body Parameters - - - -
- More Information - - - - - Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login). - - - - - Period of time after which peer login expires (seconds). - - - - - Enables or disables peer inactivity expiration globally. After peer's session has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login). - - - - - Period of time of inactivity after which peer session expires (seconds). - - - - - Allows blocking regular users from viewing parts of the system. - - - - - Allows propagate the new user auto groups to peers that belongs to the user - - - - - Allows extract groups from JWT claim and add it to account groups. - - - - - Name of the claim from which we extract groups names to add it to account groups. - - - - - List of groups to which users are allowed access - - - - - Enables or disables DNS resolution on the routing peers - - - - - Allows to define a custom dns domain for the account - - - - -
- More Information - - - - - (Cloud only) Enables or disables peer approval globally. If enabled, all peers added will be in pending state until approved by an admin. - - - - - Enables or disables network traffic logging. If enabled, all network traffic events from peers will be stored. - - - - - Enables or disables network traffic packet counter. If enabled, network packets and their size will be counted and reported. (This can have an slight impact on performance) - - - - - -
- -
- - - Enables or disables experimental lazy connection - - -
- -
-
- -
- - -
- More Information - - - - - Indicates whether the account signup form is pending - - - - - Indicates whether the account onboarding flow is pending - - - - - -
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/accounts/{accountId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/accounts/{accountId}', - 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/accounts/{accountId}" -payload = json.dumps({ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}) -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/accounts/{accountId}" - method := "PUT" - - payload := strings.NewReader(`{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}`) - 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/accounts/{accountId}") - -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({ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}) -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, '{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/accounts/{accountId}") - .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/accounts/{accountId}', - 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 => '{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -}', - 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": "ch8i4ug6lnn4g9hqv7l0", - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "peer_inactivity_expiration_enabled": true, - "peer_inactivity_expiration": 43200, - "regular_users_view_blocked": true, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "routing_peer_dns_resolution_enabled": true, - "dns_domain": "my-organization.org", - "extra": { - "peer_approval_enabled": true, - "network_traffic_logs_enabled": true, - "network_traffic_packet_counter_enabled": true - }, - "lazy_connection_enabled": true - }, - "domain": "netbird.io", - "domain_category": "private", - "created_at": "2023-05-05T09:00:35.477782Z", - "created_by": "google-oauth2|277474792786460067937", - "onboarding": { - "signup_form_pending": true, - "onboarding_flow_pending": false - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "settings": { - "peer_login_expiration_enabled": "boolean", - "peer_login_expiration": "integer", - "peer_inactivity_expiration_enabled": "boolean", - "peer_inactivity_expiration": "integer", - "regular_users_view_blocked": "boolean", - "groups_propagation_enabled": "boolean", - "jwt_groups_enabled": "boolean", - "jwt_groups_claim_name": "string", - "jwt_allow_groups": [ - "string" - ], - "routing_peer_dns_resolution_enabled": "boolean", - "dns_domain": "string", - "extra": { - "peer_approval_enabled": "boolean", - "network_traffic_logs_enabled": "boolean", - "network_traffic_packet_counter_enabled": "boolean" - }, - "lazy_connection_enabled": "boolean" - }, - "domain": "string", - "domain_category": "string", - "created_at": "string", - "created_by": "string", - "onboarding": { - "signup_form_pending": "boolean", - "onboarding_flow_pending": "boolean" - } -} -``` - - - - -
- ---- diff --git a/src/pages/ipa/resources/dns.mdx b/src/pages/ipa/resources/dns.mdx deleted file mode 100644 index 8ca013e2..00000000 --- a/src/pages/ipa/resources/dns.mdx +++ /dev/null @@ -1,1878 +0,0 @@ -export const title = 'DNS' - - - -## List all Nameserver Groups {{ tag: 'GET' , label: '/api/dns/nameservers' }} - - - - Returns a list of all Nameserver Groups - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/dns/nameservers \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/dns/nameservers', - headers: { - 'Accept': 'application/json', - 'Authorization': 'Token ' - } -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/nameservers" - -headers = { - 'Accept': 'application/json', - 'Authorization': 'Token ' -} - -response = requests.request("GET", url, headers=headers) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/dns/nameservers" - method := "GET" - - client := &http.Client { - } - req, err := http.NewRequest(method, url, nil) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Accept", "application/json") - req.Header.Add("Authorization", "Token ") - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(string(body)) -} -``` - -```ruby -require "uri" -require "json" -require "net/http" - -url = URI("https://api.netbird.io/api/dns/nameservers") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Get.new(url) -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -response = https.request(request) -puts response.read_body -``` - -```java -OkHttpClient client = new OkHttpClient().newBuilder() - .build(); - -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/nameservers") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/nameservers', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_HTTPHEADER => array( - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -[ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" - } -] -``` - - - - - - ---- - - -## Create a Nameserver Group {{ tag: 'POST' , label: '/api/dns/nameservers' }} - - - - Creates a Nameserver Group - - ### Request-Body Parameters - - - - Name of nameserver group name - - - - - Description of the nameserver group - - - - -
- Nameserver list - - - - - Nameserver IP - - - - - Nameserver Type - - - - - Nameserver Port - - - - - -
- -
- - - Nameserver group status - - - - - Distribution group IDs that defines group of peers that will use this nameserver group - - - - - Defines if a nameserver group is primary that resolves all domains. It should be true only if domains list is empty. - - - - - Match domain list. It should be empty only if primary is true. - - - - - Search domain status for match domains. It should be true only if domains list is not empty. - - -
- - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/dns/nameservers \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/dns/nameservers', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Token ' - }, - data : data -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/nameservers" -payload = json.dumps({ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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/dns/nameservers" - method := "POST" - - payload := strings.NewReader(`{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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/dns/nameservers") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Post.new(url) -request["Content-Type"] = "application/json" -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -request.body = JSON.dump({ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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, '{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/nameservers") - .method("POST", body) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/nameservers', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'POST', - CURLOPT_POSTFIELDS => '{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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": "ch8i4ug6lnn4g9hqv7m0", - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" -} -``` - - - - -
- ---- - - -## Retrieve a Nameserver Group {{ tag: 'GET' , label: '/api/dns/nameservers/{nsgroupId}' }} - - - - Get information about a Nameserver Groups - - ### Path Parameters - - - - The unique identifier of a Nameserver Group - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/dns/nameservers/{nsgroupId}', - headers: { - 'Accept': 'application/json', - 'Authorization': 'Token ' - } -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" - -headers = { - 'Accept': 'application/json', - 'Authorization': 'Token ' -} - -response = requests.request("GET", url, headers=headers) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" - method := "GET" - - client := &http.Client { - } - req, err := http.NewRequest(method, url, nil) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Accept", "application/json") - req.Header.Add("Authorization", "Token ") - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(string(body)) -} -``` - -```ruby -require "uri" -require "json" -require "net/http" - -url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Get.new(url) -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -response = https.request(request) -puts response.read_body -``` - -```java -OkHttpClient client = new OkHttpClient().newBuilder() - .build(); - -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/nameservers/{nsgroupId}', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_HTTPHEADER => array( - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" -} -``` - - - - - - ---- - - -## Update a Nameserver Group {{ tag: 'PUT' , label: '/api/dns/nameservers/{nsgroupId}' }} - - - - Update/Replace a Nameserver Group - - ### Path Parameters - - - - The unique identifier of a Nameserver Group - - - - ### Request-Body Parameters - - - - Name of nameserver group name - - - - - Description of the nameserver group - - - - -
- Nameserver list - - - - - Nameserver IP - - - - - Nameserver Type - - - - - Nameserver Port - - - - - -
- -
- - - Nameserver group status - - - - - Distribution group IDs that defines group of peers that will use this nameserver group - - - - - Defines if a nameserver group is primary that resolves all domains. It should be true only if domains list is empty. - - - - - Match domain list. It should be empty only if primary is true. - - - - - Search domain status for match domains. It should be true only if domains list is not empty. - - -
- - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/dns/nameservers/{nsgroupId}', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Token ' - }, - data : data -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" -payload = json.dumps({ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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/dns/nameservers/{nsgroupId}" - method := "PUT" - - payload := strings.NewReader(`{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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/dns/nameservers/{nsgroupId}") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Put.new(url) -request["Content-Type"] = "application/json" -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -request.body = JSON.dump({ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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, '{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - .method("PUT", body) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/nameservers/{nsgroupId}', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'PUT', - CURLOPT_POSTFIELDS => '{ - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": 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": "ch8i4ug6lnn4g9hqv7m0", - "name": "Google DNS", - "description": "Google DNS servers", - "nameservers": [ - { - "ip": "8.8.8.8", - "ns_type": "udp", - "port": 53 - } - ], - "enabled": true, - "groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "primary": true, - "domains": [ - "example.com" - ], - "search_domains_enabled": true -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" -} -``` - - - - -
- ---- - - -## Delete a Nameserver Group {{ tag: 'DELETE' , label: '/api/dns/nameservers/{nsgroupId}' }} - - - - Delete a Nameserver Group - - ### Path Parameters - - - - The unique identifier of a Nameserver Group - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/dns/nameservers/{nsgroupId}', - headers: { - 'Authorization': 'Token ' - } -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" - -headers = { - 'Authorization': 'Token ' -} - -response = requests.request("DELETE", url, headers=headers) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" - method := "DELETE" - - client := &http.Client { - } - req, err := http.NewRequest(method, url, nil) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Authorization", "Token ") - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(string(body)) -} -``` - -```ruby -require "uri" -require "json" -require "net/http" - -url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Delete.new(url) -request["Authorization"] = "Token " - -response = https.request(request) -puts response.read_body -``` - -```java -OkHttpClient client = new OkHttpClient().newBuilder() - .build(); - -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/nameservers/{nsgroupId}', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_HTTPHEADER => array( - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - - - - ---- - - -## Retrieve DNS settings {{ tag: 'GET' , label: '/api/dns/settings' }} - - - - Returns a DNS settings object - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/dns/settings \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/dns/settings', - headers: { - 'Accept': 'application/json', - 'Authorization': 'Token ' - } -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/settings" - -headers = { - 'Accept': 'application/json', - 'Authorization': 'Token ' -} - -response = requests.request("GET", url, headers=headers) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/dns/settings" - method := "GET" - - client := &http.Client { - } - req, err := http.NewRequest(method, url, nil) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Accept", "application/json") - req.Header.Add("Authorization", "Token ") - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(string(body)) -} -``` - -```ruby -require "uri" -require "json" -require "net/http" - -url = URI("https://api.netbird.io/api/dns/settings") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Get.new(url) -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -response = https.request(request) -puts response.read_body -``` - -```java -OkHttpClient client = new OkHttpClient().newBuilder() - .build(); - -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/settings") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/settings', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_HTTPHEADER => array( - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "items": { - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] - } -} -``` -```json {{ title: 'Schema' }} -{ - "items": { - "disabled_management_groups": [ - "string" - ] - } -} -``` - - - - - - ---- - - -## Update DNS Settings {{ tag: 'PUT' , label: '/api/dns/settings' }} - - - - Updates a DNS settings object - - ### Request-Body Parameters - - - - Groups whose DNS management is disabled - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/dns/settings \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/dns/settings', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Token ' - }, - data : data -}; - -axios(config) -.then((response) => { - console.log(JSON.stringify(response.data)); -}) -.catch((error) => { - console.log(error); -}); -``` - -```python -import requests -import json - -url = "https://api.netbird.io/api/dns/settings" -payload = json.dumps({ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}) -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Token ' -} - -response = requests.request("PUT", url, headers=headers, data=payload) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/dns/settings" - method := "PUT" - - payload := strings.NewReader(`{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}`) - client := &http.Client { - } - req, err := http.NewRequest(method, url, payload) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Content-Type", "application/json") - req.Header.Add("Accept", "application/json") - req.Header.Add("Authorization", "Token ") - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(string(body)) -} -``` - -```ruby -require "uri" -require "json" -require "net/http" - -url = URI("https://api.netbird.io/api/dns/settings") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Put.new(url) -request["Content-Type"] = "application/json" -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -request.body = JSON.dump({ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}) -response = https.request(request) -puts response.read_body -``` - -```java -OkHttpClient client = new OkHttpClient().newBuilder() - .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, '{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/dns/settings") - .method("PUT", body) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/dns/settings', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'PUT', - CURLOPT_POSTFIELDS => '{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}', - CURLOPT_HTTPHEADER => array( - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -} -``` -```json {{ title: 'Schema' }} -{ - "disabled_management_groups": [ - "string" - ] -} -``` - - - - - - ---- diff --git a/src/pages/ipa/resources/events.mdx b/src/pages/ipa/resources/events.mdx deleted file mode 100644 index 18cd79d6..00000000 --- a/src/pages/ipa/resources/events.mdx +++ /dev/null @@ -1,563 +0,0 @@ -export const title = 'Events' - - - -## List all Audit Events {{ tag: 'GET' , label: '/api/events/audit' }} - - - - Returns a list of all audit events - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/events/audit \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/events/audit', - 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/events/audit" - -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/events/audit" - 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/events/audit") - -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/events/audit") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/events/audit', - 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": 10, - "timestamp": "2023-05-05T10:04:37.473542Z", - "activity": "Route created", - "activity_code": "route.add", - "initiator_id": "google-oauth2|123456789012345678901", - "initiator_name": "John Doe", - "initiator_email": "demo@netbird.io", - "target_id": "chad9d86lnnc59g18ou0", - "meta": { - "name": "my route", - "network_range": "10.64.0.0/24", - "peer_id": "chacbco6lnnbn6cg5s91" - } - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "timestamp": "string", - "activity": "string", - "activity_code": "string", - "initiator_id": "string", - "initiator_name": "string", - "initiator_email": "string", - "target_id": "string", - "meta": { - "description": "The metadata of the event", - "type": "object", - "additionalProperties": "string", - "example": { - "name": "my route", - "network_range": "10.64.0.0/24", - "peer_id": "chacbco6lnnbn6cg5s91" - } - } - } -] -``` - - - - - - ---- - - -## List all Traffic Events {{ tag: 'GET' , label: '/api/events/network-traffic' }} - - - - Returns a list of all network traffic events - - ### Query Parameters - - - - Page number - - - - Number of items per page - - - - Filter by user ID - - - - Filter by reporter ID - - - - Filter by protocol - - - - Filter by event type - - - - Filter by connection type - - - - Filter by direction - - - - Case-insensitive partial match on user email, source/destination names, and source/destination addresses - - - - Start date for filtering events (ISO 8601 format, e.g., 2024-01-01T00:00:00Z). - - - - End date for filtering events (ISO 8601 format, e.g., 2024-01-31T23:59:59Z). - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/events/network-traffic \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/events/network-traffic', - 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/events/network-traffic" - -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/events/network-traffic" - 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/events/network-traffic") - -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/events/network-traffic") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/events/network-traffic', - 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' }} -{ - "data": [ - { - "flow_id": "61092452-b17c-4b14-b7cf-a2158c549826", - "reporter_id": "ch8i4ug6lnn4g9hqv7m0", - "source": { - "id": "ch8i4ug6lnn4g9hqv7m0", - "type": "PEER", - "name": "My Peer", - "geo_location": { - "city_name": "Berlin", - "country_code": "DE" - }, - "os": "Linux", - "address": "100.64.0.10:51820", - "dns_label": "*.mydomain.com" - }, - "destination": { - "id": "ch8i4ug6lnn4g9hqv7m0", - "type": "PEER", - "name": "My Peer", - "geo_location": { - "city_name": "Berlin", - "country_code": "DE" - }, - "os": "Linux", - "address": "100.64.0.10:51820", - "dns_label": "*.mydomain.com" - }, - "user": { - "id": "google-oauth2|123456789012345678901", - "email": "alice@netbird.io", - "name": "Alice Smith" - }, - "policy": { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "All to All" - }, - "icmp": { - "type": 8, - "code": 0 - }, - "protocol": 6, - "direction": "INGRESS", - "rx_bytes": 1234, - "rx_packets": 5, - "tx_bytes": 1234, - "tx_packets": 5, - "events": [ - { - "type": "TYPE_START", - "timestamp": {} - } - ] - } - ], - "page": { - "type": "integer", - "description": "Current page number" - }, - "page_size": { - "type": "integer", - "description": "Number of items per page" - }, - "total_records": { - "type": "integer", - "description": "Total number of event records available" - }, - "total_pages": { - "type": "integer", - "description": "Total number of pages available" - } -} -``` -```json {{ title: 'Schema' }} -{ - "data": [ - { - "flow_id": "string", - "reporter_id": "string", - "source": { - "id": "string", - "type": "string", - "name": "string", - "geo_location": { - "city_name": "string", - "country_code": "string" - }, - "os": "string", - "address": "string", - "dns_label": "string" - }, - "destination": { - "id": "string", - "type": "string", - "name": "string", - "geo_location": { - "city_name": "string", - "country_code": "string" - }, - "os": "string", - "address": "string", - "dns_label": "string" - }, - "user": { - "id": "string", - "email": "string", - "name": "string" - }, - "policy": { - "id": "string", - "name": "string" - }, - "icmp": { - "type": "integer", - "code": "integer" - }, - "protocol": "integer", - "direction": "string", - "rx_bytes": "integer", - "rx_packets": "integer", - "tx_bytes": "integer", - "tx_packets": "integer", - "events": [ - { - "type": "string", - "timestamp": "string" - } - ] - } - ], - "page": "integer", - "page_size": "integer", - "total_records": "integer", - "total_pages": "integer" -} -``` - - - - - - ---- diff --git a/src/pages/ipa/resources/geo-locations.mdx b/src/pages/ipa/resources/geo-locations.mdx deleted file mode 100644 index b5b87842..00000000 --- a/src/pages/ipa/resources/geo-locations.mdx +++ /dev/null @@ -1,364 +0,0 @@ -export const title = 'Geo Locations' - - - -## List all country codes {{ tag: 'GET' , label: '/api/locations/countries' }} - - - - Get list of all country in 2-letter ISO 3166-1 alpha-2 codes - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/locations/countries \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/locations/countries', - 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/locations/countries" - -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/locations/countries" - 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/locations/countries") - -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/locations/countries") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/locations/countries', - 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' }} -[ - "DE" -] -``` -```json {{ title: 'Schema' }} -[ - "string" -] -``` - - - - - - ---- - - -## List all city names by country {{ tag: 'GET' , label: '/api/locations/countries/{country}/cities' }} - - - - Get a list of all English city names for a given country code - - ### Path Parameters - - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/locations/countries/{country}/cities \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/locations/countries/{country}/cities', - 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/locations/countries/{country}/cities" - -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/locations/countries/{country}/cities" - 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/locations/countries/{country}/cities") - -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/locations/countries/{country}/cities") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/locations/countries/{country}/cities', - 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' }} -{ - "geoname_id": 2950158, - "city_name": "Berlin" -} -``` -```json {{ title: 'Schema' }} -{ - "geoname_id": "integer", - "city_name": "string" -} -``` - - - - - - ---- diff --git a/src/pages/ipa/resources/groups.mdx b/src/pages/ipa/resources/groups.mdx deleted file mode 100644 index 4d0cab6f..00000000 --- a/src/pages/ipa/resources/groups.mdx +++ /dev/null @@ -1,1274 +0,0 @@ -export const title = 'Groups' - - - -## List all Groups {{ tag: 'GET' , label: '/api/groups' }} - - - - Returns a list of all groups - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/groups \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/groups', - 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/groups" - -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/groups" - 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/groups") - -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/groups") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/groups', - 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": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ], - "resources": [ - { - "id": "string", - "type": "string" - } - ] - } -] -``` - - - - - - ---- - - -## Create a Group {{ tag: 'POST' , label: '/api/groups' }} - - - - Creates a group - - ### Request-Body Parameters - - - - Group name identifier - - - - - List of peers ids - - - - -
- More Information - - - - - ID of the resource - - - - - Network resource type based of the address - - - - - -
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/groups \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/groups', - 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/groups" -payload = json.dumps({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}) -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/groups" - method := "POST" - - payload := strings.NewReader(`{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}`) - 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/groups") - -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": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}) -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": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/groups") - .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/groups', - 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": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}', - 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": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ], - "resources": [ - { - "id": "string", - "type": "string" - } - ] -} -``` - - - - -
- ---- - - -## Retrieve a Group {{ tag: 'GET' , label: '/api/groups/{groupId}' }} - - - - Get information about a group - - ### Path Parameters - - - - The unique identifier of a group - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/groups/{groupId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/groups/{groupId}', - 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/groups/{groupId}" - -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/groups/{groupId}" - 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/groups/{groupId}") - -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/groups/{groupId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/groups/{groupId}', - 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": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ], - "resources": [ - { - "id": "string", - "type": "string" - } - ] -} -``` - - - - - - ---- - - -## Update a Group {{ tag: 'PUT' , label: '/api/groups/{groupId}' }} - - - - Update/Replace a group - - ### Path Parameters - - - - The unique identifier of a group - - - - ### Request-Body Parameters - - - - Group name identifier - - - - - List of peers ids - - - - -
- More Information - - - - - ID of the resource - - - - - Network resource type based of the address - - - - - -
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/groups/{groupId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/groups/{groupId}', - 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/groups/{groupId}" -payload = json.dumps({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}) -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/groups/{groupId}" - method := "PUT" - - payload := strings.NewReader(`{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}`) - 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/groups/{groupId}") - -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": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}) -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": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/groups/{groupId}") - .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/groups/{groupId}', - 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": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -}', - 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": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ], - "resources": [ - { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ], - "resources": [ - { - "id": "string", - "type": "string" - } - ] -} -``` - - - - -
- ---- - - -## Delete a Group {{ tag: 'DELETE' , label: '/api/groups/{groupId}' }} - - - - Delete a group - - ### Path Parameters - - - - The unique identifier of a group - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/groups/{groupId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/groups/{groupId}', - 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/groups/{groupId}" - -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/groups/{groupId}" - 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/groups/{groupId}") - -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/groups/{groupId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/groups/{groupId}', - 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/ingress-ports.mdx b/src/pages/ipa/resources/ingress-ports.mdx deleted file mode 100644 index e9c19ce5..00000000 --- a/src/pages/ipa/resources/ingress-ports.mdx +++ /dev/null @@ -1,2470 +0,0 @@ -export const title = 'Ingress Ports' - - - -## List all Port Allocations {{ tag: 'GET' , label: '/api/peers/{peerId}/ingress/ports' }} - - - - Returns a list of all ingress port allocations for a peer - - ### Path Parameters - - - - The unique identifier of a peer - - - - ### Query Parameters - - - - Filters ingress port allocations by name - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers/{peerId}/ingress/ports \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/ingress/ports', - 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}/ingress/ports" - -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}/ingress/ports" - 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}/ingress/ports") - -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}/ingress/ports") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}/ingress/ports', - 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": "Ingress Peer Allocation 1", - "ingress_peer_id": "x7p3kqf2rdd8j5zxw4n9", - "region": "germany", - "enabled": true, - "ingress_ip": "192.34.0.123", - "port_range_mappings": [ - { - "translated_start": 80, - "translated_end": 320, - "ingress_start": 1080, - "ingress_end": 1320, - "protocol": "tcp" - } - ] - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "ingress_peer_id": "string", - "region": "string", - "enabled": "boolean", - "ingress_ip": "string", - "port_range_mappings": [ - { - "translated_start": "integer", - "translated_end": "integer", - "ingress_start": "integer", - "ingress_end": "integer", - "protocol": "string" - } - ] - } -] -``` - - - - - - ---- - - -## Create a Port Allocation {{ tag: 'POST' , label: '/api/peers/{peerId}/ingress/ports' }} - - - - Creates a new ingress port allocation for a peer - - ### Path Parameters - - - - The unique identifier of a peer - - - - ### Request-Body Parameters - - - - Name of the ingress port allocation - - - - - Indicates if an ingress port allocation is enabled - - - - -
- List of port ranges that are forwarded by the ingress peer - - - - - The starting port of the range of forwarded ports - - - - - The ending port of the range of forwarded ports - - - - - The protocol accepted by the port range - - - - - -
- -
- - -
- More Information - - - - - The number of ports to be forwarded - - - - - The protocol accepted by the port - - - - - -
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/peers/{peerId}/ingress/ports \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/ingress/ports', - 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}/ingress/ports" -payload = json.dumps({ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}) -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}/ingress/ports" - method := "POST" - - payload := strings.NewReader(`{ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}`) - 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}/ingress/ports") - -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": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}) -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": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/peers/{peerId}/ingress/ports") - .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}/ingress/ports', - 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": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}', - 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": "Ingress Peer Allocation 1", - "ingress_peer_id": "x7p3kqf2rdd8j5zxw4n9", - "region": "germany", - "enabled": true, - "ingress_ip": "192.34.0.123", - "port_range_mappings": [ - { - "translated_start": 80, - "translated_end": 320, - "ingress_start": 1080, - "ingress_end": 1320, - "protocol": "tcp" - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "ingress_peer_id": "string", - "region": "string", - "enabled": "boolean", - "ingress_ip": "string", - "port_range_mappings": [ - { - "translated_start": "integer", - "translated_end": "integer", - "ingress_start": "integer", - "ingress_end": "integer", - "protocol": "string" - } - ] -} -``` - - - - -
- ---- - - -## Retrieve a Port Allocation {{ tag: 'GET' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} - - - - Get information about an ingress port allocation - - ### Path Parameters - - - - The unique identifier of a peer - - - - The unique identifier of an ingress port allocation - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers/{peerId}/ingress/ports/{allocationId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/ingress/ports/{allocationId}', - 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}/ingress/ports/{allocationId}" - -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}/ingress/ports/{allocationId}" - 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}/ingress/ports/{allocationId}") - -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}/ingress/ports/{allocationId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}/ingress/ports/{allocationId}', - 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": "Ingress Peer Allocation 1", - "ingress_peer_id": "x7p3kqf2rdd8j5zxw4n9", - "region": "germany", - "enabled": true, - "ingress_ip": "192.34.0.123", - "port_range_mappings": [ - { - "translated_start": 80, - "translated_end": 320, - "ingress_start": 1080, - "ingress_end": 1320, - "protocol": "tcp" - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "ingress_peer_id": "string", - "region": "string", - "enabled": "boolean", - "ingress_ip": "string", - "port_range_mappings": [ - { - "translated_start": "integer", - "translated_end": "integer", - "ingress_start": "integer", - "ingress_end": "integer", - "protocol": "string" - } - ] -} -``` - - - - - - ---- - - -## Update a Port Allocation {{ tag: 'PUT' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} - - - - Update information about an ingress port allocation - - ### Path Parameters - - - - The unique identifier of a peer - - - - The unique identifier of an ingress port allocation - - - - ### Request-Body Parameters - - - - Name of the ingress port allocation - - - - - Indicates if an ingress port allocation is enabled - - - - -
- List of port ranges that are forwarded by the ingress peer - - - - - The starting port of the range of forwarded ports - - - - - The ending port of the range of forwarded ports - - - - - The protocol accepted by the port range - - - - - -
- -
- - -
- More Information - - - - - The number of ports to be forwarded - - - - - The protocol accepted by the port - - - - - -
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/peers/{peerId}/ingress/ports/{allocationId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/ingress/ports/{allocationId}', - 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}/ingress/ports/{allocationId}" -payload = json.dumps({ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}) -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/peers/{peerId}/ingress/ports/{allocationId}" - method := "PUT" - - payload := strings.NewReader(`{ - "name": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}`) - 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}/ingress/ports/{allocationId}") - -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": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}) -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": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/peers/{peerId}/ingress/ports/{allocationId}") - .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/peers/{peerId}/ingress/ports/{allocationId}', - 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": "Ingress Port Allocation 1", - "enabled": true, - "port_ranges": [ - { - "start": 80, - "end": 320, - "protocol": "tcp" - } - ], - "direct_port": { - "count": 5, - "protocol": "udp" - } -}', - 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": "Ingress Peer Allocation 1", - "ingress_peer_id": "x7p3kqf2rdd8j5zxw4n9", - "region": "germany", - "enabled": true, - "ingress_ip": "192.34.0.123", - "port_range_mappings": [ - { - "translated_start": 80, - "translated_end": 320, - "ingress_start": 1080, - "ingress_end": 1320, - "protocol": "tcp" - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "ingress_peer_id": "string", - "region": "string", - "enabled": "boolean", - "ingress_ip": "string", - "port_range_mappings": [ - { - "translated_start": "integer", - "translated_end": "integer", - "ingress_start": "integer", - "ingress_end": "integer", - "protocol": "string" - } - ] -} -``` - - - - -
- ---- - - -## Delete a Port Allocation {{ tag: 'DELETE' , label: '/api/peers/{peerId}/ingress/ports/{allocationId}' }} - - - - Delete an ingress port allocation - - ### Path Parameters - - - - The unique identifier of a peer - - - - The unique identifier of an ingress port allocation - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/peers/{peerId}/ingress/ports/{allocationId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/ingress/ports/{allocationId}', - 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/peers/{peerId}/ingress/ports/{allocationId}" - -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/peers/{peerId}/ingress/ports/{allocationId}" - 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/peers/{peerId}/ingress/ports/{allocationId}") - -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/peers/{peerId}/ingress/ports/{allocationId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}/ingress/ports/{allocationId}', - 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 Ingress Peers {{ tag: 'GET' , label: '/api/ingress/peers' }} - - - - Returns a list of all ingress peers - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/ingress/peers \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/ingress/peers', - 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/ingress/peers" - -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/ingress/peers" - 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/ingress/peers") - -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/ingress/peers") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/ingress/peers', - 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", - "peer_id": "x7p3kqf2rdd8j5zxw4n9", - "ingress_ip": "192.34.0.123", - "available_ports": { - "tcp": 45765, - "udp": 50000 - }, - "enabled": true, - "connected": true, - "fallback": true, - "region": "germany" - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "peer_id": "string", - "ingress_ip": "string", - "available_ports": { - "tcp": "integer", - "udp": "integer" - }, - "enabled": "boolean", - "connected": "boolean", - "fallback": "boolean", - "region": "string" - } -] -``` - - - - - - ---- - - -## Create a Ingress Peer {{ tag: 'POST' , label: '/api/ingress/peers' }} - - - - Creates a new ingress peer - - ### Request-Body Parameters - - - - ID of the peer that is used as an ingress peer - - - - - Defines if an ingress peer is enabled - - - - - Defines if an ingress peer can be used as a fallback if no ingress peer can be found in the region of the forwarded peer - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/ingress/peers \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "peer_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "peer_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": true -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/ingress/peers', - 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/ingress/peers" -payload = json.dumps({ - "peer_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": 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/ingress/peers" - method := "POST" - - payload := strings.NewReader(`{ - "peer_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": 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/ingress/peers") - -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_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": 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_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": true -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/ingress/peers") - .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/ingress/peers', - 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_id": "ch8i4ug6lnn4g9hqv7m0", - "enabled": true, - "fallback": 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": "ch8i4ug6lnn4g9hqv7m0", - "peer_id": "x7p3kqf2rdd8j5zxw4n9", - "ingress_ip": "192.34.0.123", - "available_ports": { - "tcp": 45765, - "udp": 50000 - }, - "enabled": true, - "connected": true, - "fallback": true, - "region": "germany" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer_id": "string", - "ingress_ip": "string", - "available_ports": { - "tcp": "integer", - "udp": "integer" - }, - "enabled": "boolean", - "connected": "boolean", - "fallback": "boolean", - "region": "string" -} -``` - - - - - - ---- - - -## Retrieve a Ingress Peer {{ tag: 'GET' , label: '/api/ingress/peers/{ingressPeerId}' }} - - - - Get information about an ingress peer - - ### Path Parameters - - - - The unique identifier of an ingress peer - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/ingress/peers/{ingressPeerId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/ingress/peers/{ingressPeerId}', - 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/ingress/peers/{ingressPeerId}" - -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/ingress/peers/{ingressPeerId}" - 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/ingress/peers/{ingressPeerId}") - -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/ingress/peers/{ingressPeerId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/ingress/peers/{ingressPeerId}', - 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", - "peer_id": "x7p3kqf2rdd8j5zxw4n9", - "ingress_ip": "192.34.0.123", - "available_ports": { - "tcp": 45765, - "udp": 50000 - }, - "enabled": true, - "connected": true, - "fallback": true, - "region": "germany" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer_id": "string", - "ingress_ip": "string", - "available_ports": { - "tcp": "integer", - "udp": "integer" - }, - "enabled": "boolean", - "connected": "boolean", - "fallback": "boolean", - "region": "string" -} -``` - - - - - - ---- - - -## Update a Ingress Peer {{ tag: 'PUT' , label: '/api/ingress/peers/{ingressPeerId}' }} - - - - Update information about an ingress peer - - ### Path Parameters - - - - The unique identifier of an ingress peer - - - - ### Request-Body Parameters - - - - Defines if an ingress peer is enabled - - - - - Defines if an ingress peer can be used as a fallback if no ingress peer can be found in the region of the forwarded peer - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/ingress/peers/{ingressPeerId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "enabled": true, - "fallback": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "enabled": true, - "fallback": true -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/ingress/peers/{ingressPeerId}', - 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/ingress/peers/{ingressPeerId}" -payload = json.dumps({ - "enabled": true, - "fallback": 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/ingress/peers/{ingressPeerId}" - method := "PUT" - - payload := strings.NewReader(`{ - "enabled": true, - "fallback": 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/ingress/peers/{ingressPeerId}") - -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({ - "enabled": true, - "fallback": 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, '{ - "enabled": true, - "fallback": true -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/ingress/peers/{ingressPeerId}") - .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/ingress/peers/{ingressPeerId}', - 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 => '{ - "enabled": true, - "fallback": 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": "ch8i4ug6lnn4g9hqv7m0", - "peer_id": "x7p3kqf2rdd8j5zxw4n9", - "ingress_ip": "192.34.0.123", - "available_ports": { - "tcp": 45765, - "udp": 50000 - }, - "enabled": true, - "connected": true, - "fallback": true, - "region": "germany" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer_id": "string", - "ingress_ip": "string", - "available_ports": { - "tcp": "integer", - "udp": "integer" - }, - "enabled": "boolean", - "connected": "boolean", - "fallback": "boolean", - "region": "string" -} -``` - - - - - - ---- - - -## Delete a Ingress Peer {{ tag: 'DELETE' , label: '/api/ingress/peers/{ingressPeerId}' }} - - - - Delete an ingress peer - - ### Path Parameters - - - - The unique identifier of an ingress peer - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/ingress/peers/{ingressPeerId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/ingress/peers/{ingressPeerId}', - 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/ingress/peers/{ingressPeerId}" - -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/ingress/peers/{ingressPeerId}" - 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/ingress/peers/{ingressPeerId}") - -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/ingress/peers/{ingressPeerId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/ingress/peers/{ingressPeerId}', - 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/networks.mdx b/src/pages/ipa/resources/networks.mdx deleted file mode 100644 index d0c19c67..00000000 --- a/src/pages/ipa/resources/networks.mdx +++ /dev/null @@ -1,3680 +0,0 @@ -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", - "enabled": true - } -] -``` -```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", - "enabled": "boolean" - } -] -``` - - - - - - ---- - - -## 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) - - - - - Network resource status - - - - - 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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true -} -``` -```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", - "enabled": "boolean" -} -``` - - - - - - ---- - - -## 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", - "enabled": true -} -``` -```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", - "enabled": "boolean" -} -``` - - - - - - ---- - - -## 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) - - - - - Network resource status - - - - - 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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true, - "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", - "enabled": true -} -``` -```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", - "enabled": "boolean" -} -``` - - - - - - ---- - - -## 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, - "enabled": true - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "peer": "string", - "peer_groups": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "enabled": "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 - - - - - Network router status - - - - - - - - - -```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, - "enabled": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "metric": 9999, - "masquerade": true, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": true -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer": "string", - "peer_groups": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "enabled": "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, - "enabled": true -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer": "string", - "peer_groups": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "enabled": "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 - - - - - Network router status - - - - - - - - - -```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, - "enabled": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "metric": 9999, - "masquerade": true, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": 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, - "enabled": true -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "peer": "string", - "peer_groups": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "enabled": "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; -``` - - - - - - - - ---- - - -## List all Network Routers {{ tag: 'GET' , label: '/api/networks/routers' }} - - - - Returns a list of all routers in a network - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/networks/routers \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/networks/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/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/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/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/routers") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/networks/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, - "enabled": true - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "peer": "string", - "peer_groups": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "enabled": "boolean" - } -] -``` - - - - - - ---- diff --git a/src/pages/ipa/resources/peers.mdx b/src/pages/ipa/resources/peers.mdx deleted file mode 100644 index c839c333..00000000 --- a/src/pages/ipa/resources/peers.mdx +++ /dev/null @@ -1,1232 +0,0 @@ -export const title = 'Peers' - - - -## List all Peers {{ tag: 'GET' , label: '/api/peers' }} - - - - Returns a list of all peers - - ### Query Parameters - - - - Filter peers by name - - - - Filter peers by IP address - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers', - 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" - -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" - 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") - -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") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers', - 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": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "connection_ip": "35.64.0.1", - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z", - "os": "Darwin 13.2.1", - "kernel_version": "23.2.0", - "geoname_id": 2643743, - "version": "0.14.0", - "groups": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api" - } - ], - "ssh_enabled": true, - "user_id": "google-oauth2|277474792786460067937", - "hostname": "stage-host-1", - "ui_version": "0.14.0", - "dns_label": "stage-host-1.netbird.cloud", - "login_expiration_enabled": false, - "login_expired": false, - "last_login": "2023-05-05T09:00:35.477782Z", - "inactivity_expiration_enabled": false, - "approval_required": true, - "country_code": "DE", - "city_name": "Berlin", - "serial_number": "C02XJ0J0JGH7", - "extra_dns_labels": [ - "stage-host-1" - ], - "ephemeral": false, - "accessible_peers_count": 5 - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "ip": "string", - "connection_ip": "string", - "connected": "boolean", - "last_seen": "string", - "os": "string", - "kernel_version": "string", - "geoname_id": "integer", - "version": "string", - "groups": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string" - } - ], - "ssh_enabled": "boolean", - "user_id": "string", - "hostname": "string", - "ui_version": "string", - "dns_label": "string", - "login_expiration_enabled": "boolean", - "login_expired": "boolean", - "last_login": "string", - "inactivity_expiration_enabled": "boolean", - "approval_required": "boolean", - "country_code": "string", - "city_name": "string", - "serial_number": "string", - "extra_dns_labels": [ - "string" - ], - "ephemeral": "boolean", - "accessible_peers_count": "integer" - } -] -``` - - - - - - ---- - - -## Retrieve a Peer {{ tag: 'GET' , label: '/api/peers/{peerId}' }} - - - - Get information about a peer - - ### Path Parameters - - - - The unique identifier of a peer - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers/{peerId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}', - 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}" - -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}" - 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}") - -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}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}', - 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": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "connection_ip": "35.64.0.1", - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z", - "os": "Darwin 13.2.1", - "kernel_version": "23.2.0", - "geoname_id": 2643743, - "version": "0.14.0", - "groups": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api" - } - ], - "ssh_enabled": true, - "user_id": "google-oauth2|277474792786460067937", - "hostname": "stage-host-1", - "ui_version": "0.14.0", - "dns_label": "stage-host-1.netbird.cloud", - "login_expiration_enabled": false, - "login_expired": false, - "last_login": "2023-05-05T09:00:35.477782Z", - "inactivity_expiration_enabled": false, - "approval_required": true, - "country_code": "DE", - "city_name": "Berlin", - "serial_number": "C02XJ0J0JGH7", - "extra_dns_labels": [ - "stage-host-1" - ], - "ephemeral": false -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "ip": "string", - "connection_ip": "string", - "connected": "boolean", - "last_seen": "string", - "os": "string", - "kernel_version": "string", - "geoname_id": "integer", - "version": "string", - "groups": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string" - } - ], - "ssh_enabled": "boolean", - "user_id": "string", - "hostname": "string", - "ui_version": "string", - "dns_label": "string", - "login_expiration_enabled": "boolean", - "login_expired": "boolean", - "last_login": "string", - "inactivity_expiration_enabled": "boolean", - "approval_required": "boolean", - "country_code": "string", - "city_name": "string", - "serial_number": "string", - "extra_dns_labels": [ - "string" - ], - "ephemeral": "boolean" -} -``` - - - - - - ---- - - -## Update a Peer {{ tag: 'PUT' , label: '/api/peers/{peerId}' }} - - - - Update information about a peer - - ### Path Parameters - - - - The unique identifier of a peer - - - - ### Request-Body Parameters - - - - - - - - - - - - - - - - - - - - - - - - (Cloud only) Indicates whether peer needs approval - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/peers/{peerId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": true -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}', - 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}" -payload = json.dumps({ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": 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/peers/{peerId}" - method := "PUT" - - payload := strings.NewReader(`{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": 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/peers/{peerId}") - -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": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": 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, '{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": true -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/peers/{peerId}") - .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/peers/{peerId}', - 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": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "inactivity_expiration_enabled": false, - "approval_required": 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": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "connection_ip": "35.64.0.1", - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z", - "os": "Darwin 13.2.1", - "kernel_version": "23.2.0", - "geoname_id": 2643743, - "version": "0.14.0", - "groups": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "resources_count": 5, - "issued": "api" - } - ], - "ssh_enabled": true, - "user_id": "google-oauth2|277474792786460067937", - "hostname": "stage-host-1", - "ui_version": "0.14.0", - "dns_label": "stage-host-1.netbird.cloud", - "login_expiration_enabled": false, - "login_expired": false, - "last_login": "2023-05-05T09:00:35.477782Z", - "inactivity_expiration_enabled": false, - "approval_required": true, - "country_code": "DE", - "city_name": "Berlin", - "serial_number": "C02XJ0J0JGH7", - "extra_dns_labels": [ - "stage-host-1" - ], - "ephemeral": false -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "ip": "string", - "connection_ip": "string", - "connected": "boolean", - "last_seen": "string", - "os": "string", - "kernel_version": "string", - "geoname_id": "integer", - "version": "string", - "groups": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "resources_count": "integer", - "issued": "string" - } - ], - "ssh_enabled": "boolean", - "user_id": "string", - "hostname": "string", - "ui_version": "string", - "dns_label": "string", - "login_expiration_enabled": "boolean", - "login_expired": "boolean", - "last_login": "string", - "inactivity_expiration_enabled": "boolean", - "approval_required": "boolean", - "country_code": "string", - "city_name": "string", - "serial_number": "string", - "extra_dns_labels": [ - "string" - ], - "ephemeral": "boolean" -} -``` - - - - - - ---- - - -## Delete a Peer {{ tag: 'DELETE' , label: '/api/peers/{peerId}' }} - - - - Delete a peer - - ### Path Parameters - - - - The unique identifier of a peer - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/peers/{peerId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}', - 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/peers/{peerId}" - -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/peers/{peerId}" - 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/peers/{peerId}") - -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/peers/{peerId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}', - 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 accessible Peers {{ tag: 'GET' , label: '/api/peers/{peerId}/accessible-peers' }} - - - - Returns a list of peers that the specified peer can connect to within the network. - - ### Path Parameters - - - - The unique identifier of a peer - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/peers/{peerId}/accessible-peers \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/peers/{peerId}/accessible-peers', - 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}/accessible-peers" - -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}/accessible-peers" - 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}/accessible-peers") - -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}/accessible-peers") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/peers/{peerId}/accessible-peers', - 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": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "dns_label": "stage-host-1.netbird.cloud", - "user_id": "google-oauth2|277474792786460067937", - "os": "linux", - "country_code": "DE", - "city_name": "Berlin", - "geoname_id": 2643743, - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z" - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "ip": "string", - "dns_label": "string", - "user_id": "string", - "os": "string", - "country_code": "string", - "city_name": "string", - "geoname_id": "integer", - "connected": "boolean", - "last_seen": "string" - } -] -``` - - - - - - ---- diff --git a/src/pages/ipa/resources/policies.mdx b/src/pages/ipa/resources/policies.mdx deleted file mode 100644 index 7ee56d83..00000000 --- a/src/pages/ipa/resources/policies.mdx +++ /dev/null @@ -1,2214 +0,0 @@ -export const title = 'Policies' - - - -## List all Policies {{ tag: 'GET' , label: '/api/policies' }} - - - - Returns a list of all policies - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/policies \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/policies', - 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/policies" - -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/policies" - 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/policies") - -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/policies") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/policies', - 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' }} -[ - { - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "id": "ch8i4ug6lnn4g9hqv7mg", - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - { - "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" - } - } - ] - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "name": "string", - "description": "string", - "enabled": "boolean", - "id": "string", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "port_ranges": [ - { - "start": "integer", - "end": "integer" - } - ], - "id": "string", - "sources": [ - { - "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" - } - } - ] - } -] -``` - - - - - - ---- - - -## Create a Policy {{ tag: 'POST' , label: '/api/policies' }} - - - - Creates a policy - - ### Request-Body Parameters - - - - Policy name identifier - - - - - Policy friendly description - - - - - Policy status - - - - - Posture checks ID's applied to policy source groups - - - - -
- Policy rule object for policy UI editor - - - - - Policy rule name identifier - - - - - Policy rule friendly description - - - - - Policy rule status - - - - - Policy rule accept or drops packets - - - - - Define if the rule is applicable in both directions, sources, and destinations. - - - - - Policy rule type of the traffic - - - - - Policy rule affected ports - - - - -
- Policy rule affected ports ranges list - - - - - The starting port of the range - - - - - The ending port of the range - - - - - -
- -
- - - Policy rule ID - - - - - 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 - - - - - -
- -
-
- -
-
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/policies \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/policies', - 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/policies" -payload = json.dumps({ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}) -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/policies" - method := "POST" - - payload := strings.NewReader(`{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}`) - 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/policies") - -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": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}) -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": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/policies") - .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/policies', - 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": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}', - CURLOPT_HTTPHEADER => array( - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "id": "ch8i4ug6lnn4g9hqv7mg", - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - { - "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" - } - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "name": "string", - "description": "string", - "enabled": "boolean", - "id": "string", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "port_ranges": [ - { - "start": "integer", - "end": "integer" - } - ], - "id": "string", - "sources": [ - { - "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" - } - } - ] -} -``` - - - - -
- ---- - - -## Retrieve a Policy {{ tag: 'GET' , label: '/api/policies/{policyId}' }} - - - - Get information about a Policies - - ### Path Parameters - - - - The unique identifier of a policy - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/policies/{policyId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/policies/{policyId}', - 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/policies/{policyId}" - -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/policies/{policyId}" - 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/policies/{policyId}") - -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/policies/{policyId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/policies/{policyId}', - 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' }} -{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "id": "ch8i4ug6lnn4g9hqv7mg", - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - { - "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" - } - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "name": "string", - "description": "string", - "enabled": "boolean", - "id": "string", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "port_ranges": [ - { - "start": "integer", - "end": "integer" - } - ], - "id": "string", - "sources": [ - { - "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" - } - } - ] -} -``` - - - - - - ---- - - -## Update a Policy {{ tag: 'PUT' , label: '/api/policies/{policyId}' }} - - - - Update/Replace a Policy - - ### Path Parameters - - - - The unique identifier of a policy - - - - ### Request-Body Parameters - - - - Policy name identifier - - - - - Policy friendly description - - - - - Policy status - - - - - Posture checks ID's applied to policy source groups - - - - -
- Policy rule object for policy UI editor - - - - - Policy rule name identifier - - - - - Policy rule friendly description - - - - - Policy rule status - - - - - Policy rule accept or drops packets - - - - - Define if the rule is applicable in both directions, sources, and destinations. - - - - - Policy rule type of the traffic - - - - - Policy rule affected ports - - - - -
- Policy rule affected ports ranges list - - - - - The starting port of the range - - - - - The ending port of the range - - - - - -
- -
- - - Policy rule ID - - - - - 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 - - - - - -
- -
-
- -
-
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/policies/{policyId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/policies/{policyId}', - 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/policies/{policyId}" -payload = json.dumps({ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}) -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/policies/{policyId}" - method := "PUT" - - payload := strings.NewReader(`{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}`) - 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/policies/{policyId}") - -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": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}) -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": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/policies/{policyId}") - .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/policies/{policyId}', - 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": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "sourceResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - }, - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ], - "destinationResource": { - "id": "chacdk86lnnboviihd7g", - "type": "host" - } - } - ] -}', - CURLOPT_HTTPHEADER => array( - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "id": "ch8i4ug6lnn4g9hqv7mg", - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "port_ranges": [ - { - "start": 80, - "end": 320 - } - ], - "id": "ch8i4ug6lnn4g9hqv7mg", - "sources": [ - { - "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" - } - } - ] -} -``` -```json {{ title: 'Schema' }} -{ - "name": "string", - "description": "string", - "enabled": "boolean", - "id": "string", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "port_ranges": [ - { - "start": "integer", - "end": "integer" - } - ], - "id": "string", - "sources": [ - { - "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" - } - } - ] -} -``` - - - - -
- ---- - - -## Delete a Policy {{ tag: 'DELETE' , label: '/api/policies/{policyId}' }} - - - - Delete a policy - - ### Path Parameters - - - - The unique identifier of a policy - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/policies/{policyId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/policies/{policyId}', - 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/policies/{policyId}" - -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/policies/{policyId}" - 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/policies/{policyId}") - -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/policies/{policyId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/policies/{policyId}', - 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/posture-checks.mdx b/src/pages/ipa/resources/posture-checks.mdx deleted file mode 100644 index 1b6a314a..00000000 --- a/src/pages/ipa/resources/posture-checks.mdx +++ /dev/null @@ -1,2506 +0,0 @@ -export const title = 'Posture Checks' - - - -## List all Posture Checks {{ tag: 'GET' , label: '/api/posture-checks' }} - - - - Returns a list of all posture checks - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/posture-checks \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/posture-checks', - 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/posture-checks" - -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/posture-checks" - 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/posture-checks") - -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/posture-checks") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/posture-checks', - 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": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - }, - "process_check": { - "processes": [ - { - "linux_path": "string", - "mac_path": "string", - "windows_path": "string" - } - ] - } - } - } -] -``` - - - - - - ---- - - -## Create a Posture Check {{ tag: 'POST' , label: '/api/posture-checks' }} - - - - Creates a posture check - - ### Request-Body Parameters - - - - Posture check name identifier - - - - - Posture check friendly description - - - - -
- List of objects that perform the actual checks - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
-
- -
-
- -
- - -
- Posture check for geo location - - - - -
- List of geo locations to which the policy applies - - - - - 2-letter ISO 3166-1 alpha-2 code that represents the country - - - - - Commonly used English name of the city - - - - - -
- -
- - - Action to take upon policy match - - -
- -
-
- -
- - -
- Posture check for allow or deny access based on peer local network addresses - - - - - List of peer network ranges in CIDR notation - - - - - Action to take upon policy match - - - - - -
- -
- - -
- Posture Check for binaries exist and are running in the peer’s system - - - - -
- More Information - - - - - Path to the process executable file in a Linux operating system - - - - - Path to the process executable file in a Mac operating system - - - - - Path to the process executable file in a Windows operating system - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/posture-checks \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/posture-checks', - 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/posture-checks" -payload = json.dumps({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}) -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/posture-checks" - method := "POST" - - payload := strings.NewReader(`{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}`) - 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/posture-checks") - -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": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}) -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": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/posture-checks") - .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/posture-checks', - 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": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}', - 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": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - }, - "process_check": { - "processes": [ - { - "linux_path": "string", - "mac_path": "string", - "windows_path": "string" - } - ] - } - } -} -``` - - - - -
- ---- - - -## Retrieve a Posture Check {{ tag: 'GET' , label: '/api/posture-checks/{postureCheckId}' }} - - - - Get information about a posture check - - ### Path Parameters - - - - The unique identifier of a posture check - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/posture-checks/{postureCheckId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/posture-checks/{postureCheckId}', - 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/posture-checks/{postureCheckId}" - -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/posture-checks/{postureCheckId}" - 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/posture-checks/{postureCheckId}") - -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/posture-checks/{postureCheckId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/posture-checks/{postureCheckId}', - 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": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - }, - "process_check": { - "processes": [ - { - "linux_path": "string", - "mac_path": "string", - "windows_path": "string" - } - ] - } - } -} -``` - - - - - - ---- - - -## Update a Posture Check {{ tag: 'PUT' , label: '/api/posture-checks/{postureCheckId}' }} - - - - Update/Replace a posture check - - ### Path Parameters - - - - The unique identifier of a posture check - - - - ### Request-Body Parameters - - - - Posture check name identifier - - - - - Posture check friendly description - - - - -
- List of objects that perform the actual checks - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
-
- -
-
- -
- - -
- Posture check for geo location - - - - -
- List of geo locations to which the policy applies - - - - - 2-letter ISO 3166-1 alpha-2 code that represents the country - - - - - Commonly used English name of the city - - - - - -
- -
- - - Action to take upon policy match - - -
- -
-
- -
- - -
- Posture check for allow or deny access based on peer local network addresses - - - - - List of peer network ranges in CIDR notation - - - - - Action to take upon policy match - - - - - -
- -
- - -
- Posture Check for binaries exist and are running in the peer’s system - - - - -
- More Information - - - - - Path to the process executable file in a Linux operating system - - - - - Path to the process executable file in a Mac operating system - - - - - Path to the process executable file in a Windows operating system - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
-
- - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/posture-checks/{postureCheckId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/posture-checks/{postureCheckId}', - 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/posture-checks/{postureCheckId}" -payload = json.dumps({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}) -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/posture-checks/{postureCheckId}" - method := "PUT" - - payload := strings.NewReader(`{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}`) - 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/posture-checks/{postureCheckId}") - -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": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}) -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": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/posture-checks/{postureCheckId}") - .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/posture-checks/{postureCheckId}', - 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": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -}', - 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": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ], - "action": "allow" - }, - "process_check": { - "processes": [ - { - "linux_path": "/usr/local/bin/netbird", - "mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird", - "windows_path": "C:
rogramData…etBird\netbird.exe" - } - ] - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - }, - "process_check": { - "processes": [ - { - "linux_path": "string", - "mac_path": "string", - "windows_path": "string" - } - ] - } - } -} -``` - - - - -
- ---- - - -## Delete a Posture Check {{ tag: 'DELETE' , label: '/api/posture-checks/{postureCheckId}' }} - - - - Delete a posture check - - ### Path Parameters - - - - The unique identifier of a posture check - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/posture-checks/{postureCheckId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/posture-checks/{postureCheckId}', - 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/posture-checks/{postureCheckId}" - -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/posture-checks/{postureCheckId}" - 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/posture-checks/{postureCheckId}") - -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/posture-checks/{postureCheckId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/posture-checks/{postureCheckId}', - 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/routes.mdx b/src/pages/ipa/resources/routes.mdx deleted file mode 100644 index 9dfeb45a..00000000 --- a/src/pages/ipa/resources/routes.mdx +++ /dev/null @@ -1,1510 +0,0 @@ -export const title = 'Routes' - - - -## List all Routes {{ tag: 'GET' , label: '/api/routes' }} - - - - Returns a list of all routes - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/routes \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/routes', - 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/routes" - -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/routes" - 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/routes") - -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/routes") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/routes', - 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", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "domains": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ], - "keep_route": "boolean", - "access_control_groups": [ - "string" - ] - } -] -``` - - - - - - ---- - - -## Create a Route {{ tag: 'POST' , label: '/api/routes' }} - - - - Creates a Route - - ### Request-Body Parameters - - - - Route description - - - - - Route network identifier, to group HA routes - - - - - Route status - - - - - 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` - - - - - Network range in CIDR format, Conflicts with domains - - - - - Domain list to be dynamically resolved. Max of 32 domains can be added per route configuration. Conflicts with network - - - - - Route metric number. Lowest number has higher priority - - - - - Indicate if peer should masquerade traffic to this route's prefix - - - - - Group IDs containing routing peers - - - - - Indicate if the route should be kept after a domain doesn't resolve that IP anymore - - - - - Access control group identifier associated with route. - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/routes \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/routes', - 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/routes" -payload = json.dumps({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}) -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/routes" - method := "POST" - - payload := strings.NewReader(`{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}`) - 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/routes") - -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({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}) -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, '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/routes") - .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/routes', - 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 => '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}', - 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", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "domains": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ], - "keep_route": "boolean", - "access_control_groups": [ - "string" - ] -} -``` - - - - - - ---- - - -## Retrieve a Route {{ tag: 'GET' , label: '/api/routes/{routeId}' }} - - - - Get information about a Routes - - ### Path Parameters - - - - The unique identifier of a route - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/routes/{routeId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/routes/{routeId}', - 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/routes/{routeId}" - -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/routes/{routeId}" - 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/routes/{routeId}") - -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/routes/{routeId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/routes/{routeId}', - 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", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "domains": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ], - "keep_route": "boolean", - "access_control_groups": [ - "string" - ] -} -``` - - - - - - ---- - - -## Update a Route {{ tag: 'PUT' , label: '/api/routes/{routeId}' }} - - - - Update/Replace a Route - - ### Path Parameters - - - - The unique identifier of a route - - - - ### Request-Body Parameters - - - - Route description - - - - - Route network identifier, to group HA routes - - - - - Route status - - - - - 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` - - - - - Network range in CIDR format, Conflicts with domains - - - - - Domain list to be dynamically resolved. Max of 32 domains can be added per route configuration. Conflicts with network - - - - - Route metric number. Lowest number has higher priority - - - - - Indicate if peer should masquerade traffic to this route's prefix - - - - - Group IDs containing routing peers - - - - - Indicate if the route should be kept after a domain doesn't resolve that IP anymore - - - - - Access control group identifier associated with route. - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/routes/{routeId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/routes/{routeId}', - 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/routes/{routeId}" -payload = json.dumps({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}) -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/routes/{routeId}" - method := "PUT" - - payload := strings.NewReader(`{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}`) - 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/routes/{routeId}") - -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({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}) -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, '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/routes/{routeId}") - .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/routes/{routeId}', - 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 => '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -}', - 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", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "domains": [ - "example.com" - ], - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ], - "keep_route": true, - "access_control_groups": [ - "chacbco6lnnbn6cg5s91" - ] -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "domains": [ - "string" - ], - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ], - "keep_route": "boolean", - "access_control_groups": [ - "string" - ] -} -``` - - - - - - ---- - - -## Delete a Route {{ tag: 'DELETE' , label: '/api/routes/{routeId}' }} - - - - Delete a route - - ### Path Parameters - - - - The unique identifier of a route - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/routes/{routeId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/routes/{routeId}', - 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/routes/{routeId}" - -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/routes/{routeId}" - 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/routes/{routeId}") - -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/routes/{routeId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/routes/{routeId}', - 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/setup-keys.mdx b/src/pages/ipa/resources/setup-keys.mdx deleted file mode 100644 index a8698eb8..00000000 --- a/src/pages/ipa/resources/setup-keys.mdx +++ /dev/null @@ -1,1206 +0,0 @@ -export const title = 'Setup Keys' - - - -## List all Setup Keys {{ tag: 'GET' , label: '/api/setup-keys' }} - - - - Returns a list of all Setup Keys - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/setup-keys \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/setup-keys', - 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/setup-keys" - -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/setup-keys" - 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/setup-keys") - -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/setup-keys") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/setup-keys', - 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": 2531583362, - "name": "Default key", - "expires": "2023-06-01T14:47:22.291057Z", - "type": "reusable", - "valid": true, - "revoked": false, - "used_times": 2, - "last_used": "2023-05-05T09:00:35.477782Z", - "state": "valid", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true, - "key": "A6160****" - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean", - "allow_extra_dns_labels": "boolean", - "key": "string" - } -] -``` - - - - - - ---- - - -## Create a Setup Key {{ tag: 'POST' , label: '/api/setup-keys' }} - - - - Creates a setup key - - ### Request-Body Parameters - - - - Setup Key name - - - - - Setup key type, one-off for single time usage and reusable - - - - - Expiration time in seconds - - - - - List of group IDs to auto-assign to peers registered with this key - - - - - A number of times this key can be used. The value of 0 indicates the unlimited usage. - - - - - Indicate that the peer will be ephemeral or not - - - - - Allow extra DNS labels to be added to the peer - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/setup-keys \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/setup-keys', - 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/setup-keys" -payload = json.dumps({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": 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/setup-keys" - method := "POST" - - payload := strings.NewReader(`{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": 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/setup-keys") - -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": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": 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, '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/setup-keys") - .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/setup-keys', - 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": "Default key", - "type": "reusable", - "expires_in": 86400, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": 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": 2531583362, - "name": "Default key", - "expires": "2023-06-01T14:47:22.291057Z", - "type": "reusable", - "valid": true, - "revoked": false, - "used_times": 2, - "last_used": "2023-05-05T09:00:35.477782Z", - "state": "valid", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true, - "key": "A616097E-FCF0-48FA-9354-CA4A61142761" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean", - "allow_extra_dns_labels": "boolean", - "key": "string" -} -``` - - - - - - ---- - - -## Retrieve a Setup Key {{ tag: 'GET' , label: '/api/setup-keys/{keyId}' }} - - - - Get information about a setup key - - ### Path Parameters - - - - The unique identifier of a setup key - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/setup-keys/{keyId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/setup-keys/{keyId}', - 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/setup-keys/{keyId}" - -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/setup-keys/{keyId}" - 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/setup-keys/{keyId}") - -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/setup-keys/{keyId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/setup-keys/{keyId}', - 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": 2531583362, - "name": "Default key", - "expires": "2023-06-01T14:47:22.291057Z", - "type": "reusable", - "valid": true, - "revoked": false, - "used_times": 2, - "last_used": "2023-05-05T09:00:35.477782Z", - "state": "valid", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true, - "key": "A6160****" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean", - "allow_extra_dns_labels": "boolean", - "key": "string" -} -``` - - - - - - ---- - - -## Update a Setup Key {{ tag: 'PUT' , label: '/api/setup-keys/{keyId}' }} - - - - Update information about a setup key - - ### Path Parameters - - - - The unique identifier of a setup key - - - - ### Request-Body Parameters - - - - Setup key revocation status - - - - - List of group IDs to auto-assign to peers registered with this key - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/setup-keys/{keyId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/setup-keys/{keyId}', - 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/setup-keys/{keyId}" -payload = json.dumps({ - "revoked": false, - "auto_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/setup-keys/{keyId}" - method := "PUT" - - payload := strings.NewReader(`{ - "revoked": false, - "auto_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/setup-keys/{keyId}") - -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({ - "revoked": false, - "auto_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, '{ - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/setup-keys/{keyId}") - .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/setup-keys/{keyId}', - 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 => '{ - "revoked": false, - "auto_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": 2531583362, - "name": "Default key", - "expires": "2023-06-01T14:47:22.291057Z", - "type": "reusable", - "valid": true, - "revoked": false, - "used_times": 2, - "last_used": "2023-05-05T09:00:35.477782Z", - "state": "valid", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true, - "allow_extra_dns_labels": true, - "key": "A6160****" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean", - "allow_extra_dns_labels": "boolean", - "key": "string" -} -``` - - - - - - ---- - - -## Delete a Setup Key {{ tag: 'DELETE' , label: '/api/setup-keys/{keyId}' }} - - - - Delete a Setup Key - - ### Path Parameters - - - - The unique identifier of a setup key - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/setup-keys/{keyId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/setup-keys/{keyId}', - 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/setup-keys/{keyId}" - -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/setup-keys/{keyId}" - 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/setup-keys/{keyId}") - -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/setup-keys/{keyId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/setup-keys/{keyId}', - 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/tokens.mdx b/src/pages/ipa/resources/tokens.mdx deleted file mode 100644 index 5cd0a7bc..00000000 --- a/src/pages/ipa/resources/tokens.mdx +++ /dev/null @@ -1,816 +0,0 @@ -export const title = 'Tokens' - - - -## List all Tokens {{ tag: 'GET' , label: '/api/users/{userId}/tokens' }} - - - - Returns a list of all tokens for a user - - ### Path Parameters - - - - The unique identifier of a user - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/users/{userId}/tokens \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/users/{userId}/tokens', - 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/users/{userId}/tokens" - -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/users/{userId}/tokens" - 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/users/{userId}/tokens") - -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/users/{userId}/tokens") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users/{userId}/tokens', - 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": "ch8i54g6lnn4g9hqv7n0", - "name": "My first token", - "expiration_date": "2023-05-05T14:38:28.977616Z", - "created_by": "google-oauth2|277474792786460067937", - "created_at": "2023-05-02T14:48:20.465209Z", - "last_used": "2023-05-04T12:45:25.9723616Z" - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "expiration_date": "string", - "created_by": "string", - "created_at": "string", - "last_used": "string" - } -] -``` - - - - - - ---- - - -## Create a Token {{ tag: 'POST' , label: '/api/users/{userId}/tokens' }} - - - - Create a new token for a user - - ### Path Parameters - - - - The unique identifier of a user - - - - ### Request-Body Parameters - - - - Name of the token - - - - - Expiration in days - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/users/{userId}/tokens \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "name": "My first token", - "expires_in": 30 -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "name": "My first token", - "expires_in": 30 -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/users/{userId}/tokens', - 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/users/{userId}/tokens" -payload = json.dumps({ - "name": "My first token", - "expires_in": 30 -}) -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/users/{userId}/tokens" - method := "POST" - - payload := strings.NewReader(`{ - "name": "My first token", - "expires_in": 30 -}`) - 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/users/{userId}/tokens") - -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": "My first token", - "expires_in": 30 -}) -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": "My first token", - "expires_in": 30 -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/users/{userId}/tokens") - .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/users/{userId}/tokens', - 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": "My first token", - "expires_in": 30 -}', - CURLOPT_HTTPHEADER => array( - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "plain_token": {}, - "personal_access_token": { - "id": "ch8i54g6lnn4g9hqv7n0", - "name": "My first token", - "expiration_date": "2023-05-05T14:38:28.977616Z", - "created_by": "google-oauth2|277474792786460067937", - "created_at": "2023-05-02T14:48:20.465209Z", - "last_used": "2023-05-04T12:45:25.9723616Z" - } -} -``` -```json {{ title: 'Schema' }} -{ - "plain_token": "string", - "personal_access_token": { - "id": "string", - "name": "string", - "expiration_date": "string", - "created_by": "string", - "created_at": "string", - "last_used": "string" - } -} -``` - - - - - - ---- - - -## Retrieve a Token {{ tag: 'GET' , label: '/api/users/{userId}/tokens/{tokenId}' }} - - - - Returns a specific token for a user - - ### Path Parameters - - - - The unique identifier of a user - - - - The unique identifier of a token - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/users/{userId}/tokens/{tokenId}', - 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/users/{userId}/tokens/{tokenId}" - -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/users/{userId}/tokens/{tokenId}" - 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/users/{userId}/tokens/{tokenId}") - -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/users/{userId}/tokens/{tokenId}") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users/{userId}/tokens/{tokenId}', - 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": "ch8i54g6lnn4g9hqv7n0", - "name": "My first token", - "expiration_date": "2023-05-05T14:38:28.977616Z", - "created_by": "google-oauth2|277474792786460067937", - "created_at": "2023-05-02T14:48:20.465209Z", - "last_used": "2023-05-04T12:45:25.9723616Z" -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "name": "string", - "expiration_date": "string", - "created_by": "string", - "created_at": "string", - "last_used": "string" -} -``` - - - - - - ---- - - -## Delete a Token {{ tag: 'DELETE' , label: '/api/users/{userId}/tokens/{tokenId}' }} - - - - Delete a token for a user - - ### Path Parameters - - - - The unique identifier of a user - - - - The unique identifier of a token - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/users/{userId}/tokens/{tokenId}', - 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/users/{userId}/tokens/{tokenId}" - -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/users/{userId}/tokens/{tokenId}" - 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/users/{userId}/tokens/{tokenId}") - -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/users/{userId}/tokens/{tokenId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users/{userId}/tokens/{tokenId}', - 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/users.mdx b/src/pages/ipa/resources/users.mdx deleted file mode 100644 index ffd30a46..00000000 --- a/src/pages/ipa/resources/users.mdx +++ /dev/null @@ -1,1510 +0,0 @@ -export const title = 'Users' - - - -## List all Users {{ tag: 'GET' , label: '/api/users' }} - - - - Returns a list of all users - - ### Query Parameters - - - - Filters users and returns either regular users or service users - - - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/users \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/users', - 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/users" - -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/users" - 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/users") - -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/users") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users', - 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": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api", - "permissions": { - "is_restricted": { - "type": "boolean", - "description": "Indicates whether this User's Peers view is restricted" - }, - "modules": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } - } -] -``` -```json {{ title: 'Schema' }} -[ - { - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string", - "permissions": { - "is_restricted": "boolean", - "modules": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": "boolean", - "propertyNames": "string" - }, - "propertyNames": "string", - "example": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } - } - } -] -``` - - - - - - ---- - - -## Create a User {{ tag: 'POST' , label: '/api/users' }} - - - - Creates a new service user or sends an invite to a regular user - - ### Request-Body Parameters - - - - User's Email to send invite to - - - - - User's full name - - - - - User's NetBird account role - - - - - Group IDs to auto-assign to peers registered by this user - - - - - Is true if this user is a service user - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/users \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}); -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/users', - 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/users" -payload = json.dumps({ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}) -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/users" - method := "POST" - - payload := strings.NewReader(`{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}`) - 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/users") - -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({ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}) -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, '{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/users") - .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/users', - 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 => '{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false -}', - 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": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api", - "permissions": { - "is_restricted": { - "type": "boolean", - "description": "Indicates whether this User's Peers view is restricted" - }, - "modules": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string", - "permissions": { - "is_restricted": "boolean", - "modules": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": "boolean", - "propertyNames": "string" - }, - "propertyNames": "string", - "example": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } - } -} -``` - - - - - - ---- - - -## Update a User {{ tag: 'PUT' , label: '/api/users/{userId}' }} - - - - Update information about a User - - ### Path Parameters - - - - The unique identifier of a user - - - - ### Request-Body Parameters - - - - User's NetBird account role - - - - - Group IDs to auto-assign to peers registered by this user - - - - - If set to true then user is blocked and can't use the system - - - - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/users/{userId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/users/{userId}', - 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/users/{userId}" -payload = json.dumps({ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}) -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/users/{userId}" - method := "PUT" - - payload := strings.NewReader(`{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}`) - 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/users/{userId}") - -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({ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}) -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, '{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/users/{userId}") - .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/users/{userId}', - 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 => '{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false -}', - 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": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api", - "permissions": { - "is_restricted": { - "type": "boolean", - "description": "Indicates whether this User's Peers view is restricted" - }, - "modules": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string", - "permissions": { - "is_restricted": "boolean", - "modules": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": "boolean", - "propertyNames": "string" - }, - "propertyNames": "string", - "example": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } - } -} -``` - - - - - - ---- - - -## Delete a User {{ tag: 'DELETE' , label: '/api/users/{userId}' }} - - - - This method removes a user from accessing the system. For this leaves the IDP user intact unless the `--user-delete-from-idp` is passed to management startup. - - ### Path Parameters - - - - The unique identifier of a user - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/users/{userId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/users/{userId}', - 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/users/{userId}" - -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/users/{userId}" - 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/users/{userId}") - -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/users/{userId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users/{userId}', - 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; -``` - - - - - - - - ---- - - -## Resend user invitation {{ tag: 'POST' , label: '/api/users/{userId}/invite' }} - - - - Resend user invitation - - ### Path Parameters - - - - The unique identifier of a user - - - - - - -```bash {{ title: 'cURL' }} -curl -X POST https://api.netbird.io/api/users/{userId}/invite \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'post', - maxBodyLength: Infinity, - url: '/api/users/{userId}/invite', - 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/users/{userId}/invite" - -headers = { - 'Authorization': 'Token ' -} - -response = requests.request("POST", url, headers=headers) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/users/{userId}/invite" - method := "POST" - - 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/users/{userId}/invite") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Post.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/users/{userId}/invite") - .method("POST") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users/{userId}/invite', - 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_HTTPHEADER => array( - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - - - - ---- - - -## Retrieve current user {{ tag: 'GET' , label: '/api/users/current' }} - - - - Get information about the current user - - - - -```bash {{ title: 'cURL' }} -curl -X GET https://api.netbird.io/api/users/current \ --H 'Accept: application/json' \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'get', - maxBodyLength: Infinity, - url: '/api/users/current', - 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/users/current" - -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/users/current" - 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/users/current") - -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/users/current") - .method("GET") - .addHeader("Accept", "application/json") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/users/current', - 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": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api", - "permissions": { - "is_restricted": { - "type": "boolean", - "description": "Indicates whether this User's Peers view is restricted" - }, - "modules": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } -} -``` -```json {{ title: 'Schema' }} -{ - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string", - "permissions": { - "is_restricted": "boolean", - "modules": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": "boolean", - "propertyNames": "string" - }, - "propertyNames": "string", - "example": { - "networks": { - "read": true, - "create": false, - "update": false, - "delete": false - }, - "peers": { - "read": false, - "create": false, - "update": false, - "delete": false - } - } - } - } -} -``` - - - - - - ----