diff --git a/generator/templates/ApiTemplate.ts b/generator/templates/ApiTemplate.ts
index d762a606..9d3d2420 100644
--- a/generator/templates/ApiTemplate.ts
+++ b/generator/templates/ApiTemplate.ts
@@ -61,7 +61,7 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
\`\`\`bash {{ title: 'cURL' }}
curl -X <%- operation.operation.toUpperCase() %> <%- operation.fullPath %> \\
--H "Authorization: Bearer {token}" \\
+-H "Authorization: Token " \\
<% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>
-H 'Accept: application/json' \\<% }; %>
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
@@ -69,31 +69,161 @@ curl -X <%- operation.operation.toUpperCase() %> <%- operation.fullPath %> \\
--data-raw '<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>'<% }; %>
\`\`\`
- \`\`\`js
- import ApiClient from '@example/protocol-api'
+\`\`\`js
+const axios = require('axios');
+<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
+let data = JSON.stringify(<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>);<% }; -%>
- const client = new ApiClient(token)
+let config = {
+ method: '<%- operation.operation.toLowerCase() %>',
+ maxBodyLength: Infinity,
+ url: '<%- operation.path %>',
+ headers: {
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type': 'application/json',<% }; %>
+ <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>'Accept': 'application/json',<% }; %>
+ 'Authorization': 'Token '
+ }<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>,<% }; %>
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
+ data : data<% }; %>
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- \`\`\`
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+\`\`\`
- \`\`\`python
- from protocol_api import ApiClient
+\`\`\`python
+import requests
+import json
- client = ApiClient(token)
+url = "<%- operation.fullPath %>"
+<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
+payload = json.dumps(<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>)<% }; -%>
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- \`\`\`
+headers = {
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type': 'application/json',<% }; %>
+ <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>'Accept': 'application/json',<% }; %>
+ 'Authorization': 'Token '
+}
- \`\`\`php
- $client = new \\Protocol\\ApiClient($token);
+response = requests.request("<%- operation.operation.toUpperCase() %>", url, headers=headers<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>, data=payload<% }; %>)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- \`\`\`
+print(response.text)
+\`\`\`
+
+\`\`\`go
+package main
+
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "<%- operation.fullPath %>"
+ method := "<%- operation.operation.toUpperCase() %>"
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
+ payload := strings.NewReader(\`<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>\`)<% }; -%>
+
+ client := &http.Client {
+ }
+ req, err := http.NewRequest(method, url, <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>payload<% } else { %>nil<% }; %>)
+
+ if err != nil {
+ fmt.Println(err)
+ return
+ }
+
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>req.Header.Add("Content-Type", "application/json")<% }; %>
+ <% if(operation.responseList[0].content && operation.responseList[0].content['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("<%- operation.fullPath %>")
+
+https = Net::HTTP.new(url.host, url.port)
+https.use_ssl = true
+
+request = Net::HTTP::Post.new(url)
+<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>request["Content-Type"] = "application/json"<% }; %>
+<% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>request["Accept"] = "application/json"<% }; %>
+request["Authorization"] = "Token "
+<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
+request.body = JSON.dump(<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>)<% }; -%>
+
+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, '<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>');
+Request request = new Request.Builder()
+ .url("<%- operation.fullPath %>")
+ .method("<%- operation.operation.toUpperCase() %>", body)
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>.addHeader("Content-Type", "application/json")<% }; %>
+ <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>.addHeader("Accept", "application/json")<% }; %>
+ .addHeader("Authorization: Token ")
+ .build();
+Response response = client.newCall(request).execute();
+\`\`\`
+
+\`\`\`php
+ '<%- operation.fullPath %>',
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => '',
+ CURLOPT_MAXREDIRS => 10,
+ CURLOPT_TIMEOUT => 0,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+ CURLOPT_CUSTOMREQUEST => '<%- operation.operation.toUpperCase() %>',
+ CURLOPT_POSTFIELDS =>'<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>',
+ CURLOPT_HTTPHEADER => array(
+ <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type: application/json',<% }; %>
+ <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>'Accept: application/json',<% }; %>
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+\`\`\`
<% operation.responseList.forEach(function(response){ %>
diff --git a/src/components/Code.jsx b/src/components/Code.jsx
index fa2324e5..5ef8c30f 100644
--- a/src/components/Code.jsx
+++ b/src/components/Code.jsx
@@ -21,6 +21,7 @@ const languageNames = {
python: 'Python',
ruby: 'Ruby',
go: 'Go',
+ java: 'Java',
}
function getPanelTitle({ title, language }) {
diff --git a/src/pages/accounts.mdx b/src/pages/accounts.mdx
index ea642c0b..b2077bd6 100644
--- a/src/pages/accounts.mdx
+++ b/src/pages/accounts.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/accounts \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/accounts',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/accounts"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/accounts")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -111,7 +232,7 @@ curl -X GET https://api.netbird.io/api/accounts \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -120,31 +241,173 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "peer_login_expiration_enabled": "boolean",
+ "peer_login_expiration": "integer"
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/accounts/{accountId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/accounts/{accountId}"
+payload = json.dumps({
+ "peer_login_expiration_enabled": "boolean",
+ "peer_login_expiration": "integer"
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/accounts/{accountId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "peer_login_expiration_enabled": "boolean",
+ "peer_login_expiration": "integer"
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "peer_login_expiration_enabled": "boolean",
+ "peer_login_expiration": "integer"
+})
+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_login_expiration_enabled": "boolean",
+ "peer_login_expiration": "integer"
+}');
+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 =>'{
+ "peer_login_expiration_enabled": "boolean",
+ "peer_login_expiration": "integer"
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/dns.mdx b/src/pages/dns.mdx
index fb44fdc8..a292fe73 100644
--- a/src/pages/dns.mdx
+++ b/src/pages/dns.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/dns/nameservers \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/dns/nameservers',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/dns/nameservers"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/dns/nameservers")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -159,7 +280,7 @@ curl -X GET https://api.netbird.io/api/dns/nameservers \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/dns/nameservers \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -183,31 +304,263 @@ curl -X POST https://api.netbird.io/api/dns/nameservers \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/dns/nameservers',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/dns/nameservers"
+payload = json.dumps({
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/dns/nameservers"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+}`)
+ 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": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+})
+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": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+}');
+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": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -267,36 +620,157 @@ curl -X POST https://api.netbird.io/api/dns/nameservers \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/dns/nameservers/{nsgroupId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -417,7 +891,7 @@ curl -X GET https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -441,31 +915,263 @@ curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/dns/nameservers/{nsgroupId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}"
+payload = json.dumps({
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/dns/nameservers/{nsgroupId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "name": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+})
+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": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+}');
+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": "string",
+ "description": "string",
+ "nameservers": [
+ {
+ "ip": "string",
+ "ns_type": "string",
+ "port": "integer"
+ }
+ ],
+ "enabled": "boolean",
+ "groups": [
+ "string"
+ ],
+ "primary": "boolean",
+ "domains": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -525,36 +1231,157 @@ curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/dns/nameservers/{nsgroupId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -579,36 +1406,157 @@ curl -X DELETE https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/dns/settings \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/dns/settings',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/dns/settings"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/dns/settings")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -658,7 +1606,7 @@ curl -X GET https://api.netbird.io/api/dns/settings \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/dns/settings \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -668,31 +1616,179 @@ curl -X PUT https://api.netbird.io/api/dns/settings \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "disabled_management_groups": [
+ "string"
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/dns/settings',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/dns/settings"
+payload = json.dumps({
+ "disabled_management_groups": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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": [
+ "string"
+ ]
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "disabled_management_groups": [
+ "string"
+ ]
+})
+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": [
+ "string"
+ ]
+}');
+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": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/events.mdx b/src/pages/events.mdx
index 994cf29d..ffcab69d 100644
--- a/src/pages/events.mdx
+++ b/src/pages/events.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/events \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/events',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/events"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+print(response.text)
+```
+
+```go
+package main
+
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/events"
+ 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")
+
+https = Net::HTTP.new(url.host, url.port)
+https.use_ssl = true
+
+request = Net::HTTP::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/events")
+ .method("GET", body)
+
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization: Token ")
+ .build();
+Response response = client.newCall(request).execute();
+```
+
+```php
+ 'https://api.netbird.io/api/events',
+ 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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/groups.mdx b/src/pages/groups.mdx
index 566e5723..9c11c337 100644
--- a/src/pages/groups.mdx
+++ b/src/pages/groups.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/groups \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/groups',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/groups"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/groups")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -107,7 +228,7 @@ curl -X GET https://api.netbird.io/api/groups \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/groups \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -118,31 +239,185 @@ curl -X POST https://api.netbird.io/api/groups \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/groups',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/groups"
+payload = json.dumps({
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/groups"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+}`)
+ 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": "string",
+ "peers": [
+ "string"
+ ]
+})
+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": "string",
+ "peers": [
+ "string"
+ ]
+}');
+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": "string",
+ "peers": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -193,36 +468,157 @@ curl -X POST https://api.netbird.io/api/groups \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/groups/{groupId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/groups/{groupId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/groups/{groupId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/groups/{groupId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -291,7 +687,7 @@ curl -X GET https://api.netbird.io/api/groups/{groupId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/groups/{groupId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -302,31 +698,185 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/groups/{groupId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/groups/{groupId}"
+payload = json.dumps({
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/groups/{groupId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "name": "string",
+ "peers": [
+ "string"
+ ]
+})
+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": "string",
+ "peers": [
+ "string"
+ ]
+}');
+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": "string",
+ "peers": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -377,36 +927,157 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/groups/{groupId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/groups/{groupId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/groups/{groupId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/groups/{groupId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/peers.mdx b/src/pages/peers.mdx
index e732f8fb..4edc664a 100644
--- a/src/pages/peers.mdx
+++ b/src/pages/peers.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/peers \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/peers',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/peers"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/peers")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -110,36 +231,157 @@ curl -X GET https://api.netbird.io/api/peers \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/peers/{peerId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/peers/{peerId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/peers/{peerId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/peers/{peerId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -228,7 +470,7 @@ curl -X GET https://api.netbird.io/api/peers/{peerId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/peers/{peerId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -238,31 +480,179 @@ curl -X PUT https://api.netbird.io/api/peers/{peerId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "ssh_enabled": "boolean",
+ "login_expiration_enabled": "boolean"
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/peers/{peerId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/peers/{peerId}"
+payload = json.dumps({
+ "name": "string",
+ "ssh_enabled": "boolean",
+ "login_expiration_enabled": "boolean"
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/peers/{peerId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "ssh_enabled": "boolean",
+ "login_expiration_enabled": "boolean"
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "name": "string",
+ "ssh_enabled": "boolean",
+ "login_expiration_enabled": "boolean"
+})
+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": "string",
+ "ssh_enabled": "boolean",
+ "login_expiration_enabled": "boolean"
+}');
+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": "string",
+ "ssh_enabled": "boolean",
+ "login_expiration_enabled": "boolean"
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -326,36 +716,157 @@ curl -X PUT https://api.netbird.io/api/peers/{peerId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/peers/{peerId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/peers/{peerId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/peers/{peerId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/peers/{peerId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/policies.mdx b/src/pages/policies.mdx
index 61aeb265..e2329f0d 100644
--- a/src/pages/policies.mdx
+++ b/src/pages/policies.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/policies \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/policies',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/policies"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/policies")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -147,7 +268,7 @@ curl -X GET https://api.netbird.io/api/policies \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/policies \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -181,31 +302,323 @@ curl -X POST https://api.netbird.io/api/policies \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/policies',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/policies"
+payload = json.dumps({
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/policies"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+}`)
+ 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": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+})
+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": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+}');
+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": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -271,36 +684,157 @@ curl -X POST https://api.netbird.io/api/policies \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/policies/{policyId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/policies/{policyId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/policies/{policyId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/policies/{policyId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -409,7 +943,7 @@ curl -X GET https://api.netbird.io/api/policies/{policyId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/policies/{policyId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -443,31 +977,323 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/policies/{policyId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/policies/{policyId}"
+payload = json.dumps({
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/policies/{policyId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+})
+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": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+}');
+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": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "query": "string",
+ "rules": [
+ {
+ "id": "string",
+ "name": "string",
+ "description": "string",
+ "enabled": "boolean",
+ "sources": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "destinations": [
+ {
+ "id": "string",
+ "name": "string",
+ "peers_count": "integer"
+ }
+ ],
+ "action": "string"
+ }
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -537,36 +1363,157 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/policies/{policyId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/policies/{policyId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/policies/{policyId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/policies/{policyId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/routes.mdx b/src/pages/routes.mdx
index bf43c41b..688de62a 100644
--- a/src/pages/routes.mdx
+++ b/src/pages/routes.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/routes \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/routes',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/routes"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/routes")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -160,7 +281,7 @@ curl -X GET https://api.netbird.io/api/routes \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/routes \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -177,31 +298,221 @@ curl -X POST https://api.netbird.io/api/routes \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/routes',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/routes"
+payload = json.dumps({
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/routes"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+}`)
+ 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": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+})
+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": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+}');
+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": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -255,36 +566,157 @@ curl -X POST https://api.netbird.io/api/routes \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/routes/{routeId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/routes/{routeId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/routes/{routeId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/routes/{routeId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -406,7 +838,7 @@ curl -X GET https://api.netbird.io/api/routes/{routeId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/routes/{routeId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -423,31 +855,221 @@ curl -X PUT https://api.netbird.io/api/routes/{routeId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/routes/{routeId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/routes/{routeId}"
+payload = json.dumps({
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/routes/{routeId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "description": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+})
+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": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+}');
+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": "string",
+ "network_id": "string",
+ "enabled": "boolean",
+ "peer": "string",
+ "network": "string",
+ "metric": "integer",
+ "masquerade": "boolean",
+ "groups": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -501,36 +1123,157 @@ curl -X PUT https://api.netbird.io/api/routes/{routeId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/routes/{routeId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/routes/{routeId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/routes/{routeId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/routes/{routeId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/rules.mdx b/src/pages/rules.mdx
index 5e1e5d0b..155b1665 100644
--- a/src/pages/rules.mdx
+++ b/src/pages/rules.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/rules \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/rules',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/rules"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+print(response.text)
+```
+
+```go
+package main
+
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/rules"
+ 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/rules")
+
+https = Net::HTTP.new(url.host, url.port)
+https.use_ssl = true
+
+request = Net::HTTP::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/rules")
+ .method("GET", body)
+
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization: Token ")
+ .build();
+Response response = client.newCall(request).execute();
+```
+
+```php
+ 'https://api.netbird.io/api/rules',
+ 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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -145,7 +266,7 @@ curl -X GET https://api.netbird.io/api/rules \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/rules \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -162,31 +283,221 @@ curl -X POST https://api.netbird.io/api/rules \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/rules',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/rules"
+payload = json.dumps({
+ "name": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/rules"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+}`)
+ 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/rules")
+
+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": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+})
+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": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+}');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/rules")
+ .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/rules',
+ 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": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -243,36 +554,157 @@ curl -X POST https://api.netbird.io/api/rules \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/rules/{ruleId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/rules/{ruleId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/rules/{ruleId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+print(response.text)
+```
+
+```go
+package main
+
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/rules/{ruleId}"
+ 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/rules/{ruleId}")
+
+https = Net::HTTP.new(url.host, url.port)
+https.use_ssl = true
+
+request = Net::HTTP::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/rules/{ruleId}")
+ .method("GET", body)
+
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization: Token ")
+ .build();
+Response response = client.newCall(request).execute();
+```
+
+```php
+ 'https://api.netbird.io/api/rules/{ruleId}',
+ 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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -379,7 +811,7 @@ curl -X GET https://api.netbird.io/api/rules/{ruleId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/rules/{ruleId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -396,31 +828,221 @@ curl -X PUT https://api.netbird.io/api/rules/{ruleId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/rules/{ruleId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/rules/{ruleId}"
+payload = json.dumps({
+ "name": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/rules/{ruleId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+}`)
+ 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/rules/{ruleId}")
+
+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": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+})
+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": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+}');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/rules/{ruleId}")
+ .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/rules/{ruleId}',
+ 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": "string",
+ "description": "string",
+ "disabled": "boolean",
+ "flow": "string",
+ "sources": [
+ "string"
+ ],
+ "destinations": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -481,36 +1103,157 @@ curl -X PUT https://api.netbird.io/api/rules/{ruleId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/rules/{ruleId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/rules/{ruleId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/rules/{ruleId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+print(response.text)
+```
+
+```go
+package main
+
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/rules/{ruleId}"
+ 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/rules/{ruleId}")
+
+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();
+MediaType mediaType = MediaType.parse("application/json");
+RequestBody body = RequestBody.create(mediaType, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/rules/{ruleId}")
+ .method("DELETE", body)
+
+
+ .addHeader("Authorization: Token ")
+ .build();
+Response response = client.newCall(request).execute();
+```
+
+```php
+ 'https://api.netbird.io/api/rules/{ruleId}',
+ 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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/setup-keys.mdx b/src/pages/setup-keys.mdx
index 87b875a1..16738eef 100644
--- a/src/pages/setup-keys.mdx
+++ b/src/pages/setup-keys.mdx
@@ -15,36 +15,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/setup-keys \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/setup-keys',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/setup-keys"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/setup-keys")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -141,7 +262,7 @@ curl -X GET https://api.netbird.io/api/setup-keys \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/setup-keys \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -156,31 +277,209 @@ curl -X POST https://api.netbird.io/api/setup-keys \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/setup-keys',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/setup-keys"
+payload = json.dumps({
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/setup-keys"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+}`)
+ 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": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+})
+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": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+}');
+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": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -237,36 +536,157 @@ curl -X POST https://api.netbird.io/api/setup-keys \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/setup-keys/{keyId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/setup-keys/{keyId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/setup-keys/{keyId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/setup-keys/{keyId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -369,7 +789,7 @@ curl -X GET https://api.netbird.io/api/setup-keys/{keyId} \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/setup-keys/{keyId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -384,31 +804,209 @@ curl -X PUT https://api.netbird.io/api/setup-keys/{keyId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/setup-keys/{keyId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/setup-keys/{keyId}"
+payload = json.dumps({
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/setup-keys/{keyId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+})
+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": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+}');
+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 =>'{
+ "name": "string",
+ "type": "string",
+ "expires_in": "integer",
+ "revoked": "boolean",
+ "auto_groups": [
+ "string"
+ ],
+ "usage_limit": "integer"
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/tokens.mdx b/src/pages/tokens.mdx
index d5ae566e..af26e4ea 100644
--- a/src/pages/tokens.mdx
+++ b/src/pages/tokens.mdx
@@ -23,36 +23,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/users/{userId}/tokens \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/users/{userId}/tokens',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/users/{userId}/tokens"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/users/{userId}/tokens")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -124,7 +245,7 @@ curl -X GET https://api.netbird.io/api/users/{userId}/tokens \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/users/{userId}/tokens \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -133,31 +254,173 @@ curl -X POST https://api.netbird.io/api/users/{userId}/tokens \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "name": "string",
+ "expires_in": "integer"
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/users/{userId}/tokens',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/users/{userId}/tokens"
+payload = json.dumps({
+ "name": "string",
+ "expires_in": "integer"
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/users/{userId}/tokens"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "name": "string",
+ "expires_in": "integer"
+}`)
+ 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": "string",
+ "expires_in": "integer"
+})
+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": "string",
+ "expires_in": "integer"
+}');
+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": "string",
+ "expires_in": "integer"
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -212,36 +475,157 @@ curl -X POST https://api.netbird.io/api/users/{userId}/tokens \
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/users/{userId}/tokens/{tokenId}',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/users/{userId}/tokens/{tokenId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -293,36 +677,157 @@ curl -X GET https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/users/{userId}/tokens/{tokenId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/users/{userId}/tokens/{tokenId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
diff --git a/src/pages/users.mdx b/src/pages/users.mdx
index 5d0719d4..8d571e7c 100644
--- a/src/pages/users.mdx
+++ b/src/pages/users.mdx
@@ -23,36 +23,157 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/users \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'get',
+ maxBodyLength: Infinity,
+ url: '/api/users',
+ headers: {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/users"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("GET", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/users")
+ .method("GET", body)
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -137,7 +258,7 @@ curl -X GET https://api.netbird.io/api/users \
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/users \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -151,31 +272,203 @@ curl -X POST https://api.netbird.io/api/users \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "email": "string",
+ "name": "string",
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ],
+ "is_service_user": "boolean"
+});
+let config = {
+ method: 'post',
+ maxBodyLength: Infinity,
+ url: '/api/users',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/users"
+payload = json.dumps({
+ "email": "string",
+ "name": "string",
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ],
+ "is_service_user": "boolean"
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("POST", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/users"
+ method := "POST"
+
+ payload := strings.NewReader(`{
+ "email": "string",
+ "name": "string",
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ],
+ "is_service_user": "boolean"
+}`)
+ 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": "string",
+ "name": "string",
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ],
+ "is_service_user": "boolean"
+})
+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": "string",
+ "name": "string",
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ],
+ "is_service_user": "boolean"
+}');
+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": "string",
+ "name": "string",
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ],
+ "is_service_user": "boolean"
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -245,7 +538,7 @@ curl -X POST https://api.netbird.io/api/users \
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/users/{userId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
@@ -256,31 +549,185 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \
}'
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
+let data = JSON.stringify({
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ]
+});
+let config = {
+ method: 'put',
+ maxBodyLength: Infinity,
+ url: '/api/users/{userId}',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+ },
+
+ data : data
+};
- const client = new ApiClient(token)
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+```python
+import requests
+import json
- ```python
- from protocol_api import ApiClient
+url = "https://api.netbird.io/api/users/{userId}"
+payload = json.dumps({
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ]
+})
+headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Token '
+}
- client = ApiClient(token)
+response = requests.request("PUT", url, headers=headers, data=payload)
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+print(response.text)
+```
- ```php
- $client = new \Protocol\ApiClient($token);
+```go
+package main
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+import (
+ "fmt"
+ "strings"
+ "net/http"
+ "io/ioutil"
+)
+
+func main() {
+
+ url := "https://api.netbird.io/api/users/{userId}"
+ method := "PUT"
+
+ payload := strings.NewReader(`{
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ]
+}`)
+ 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::Post.new(url)
+request["Content-Type"] = "application/json"
+request["Accept"] = "application/json"
+request["Authorization"] = "Token "
+
+request.body = JSON.dump({
+ "role": "string",
+ "auto_groups": [
+ "string"
+ ]
+})
+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": "string",
+ "auto_groups": [
+ "string"
+ ]
+}');
+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": "string",
+ "auto_groups": [
+ "string"
+ ]
+}',
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/json',
+ 'Accept: application/json',
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```
@@ -332,36 +779,157 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/users/{userId} \
--H "Authorization: Bearer {token}" \
+-H "Authorization: Token " \
```
- ```js
- import ApiClient from '@example/protocol-api'
+```js
+const axios = require('axios');
- const client = new ApiClient(token)
+let config = {
+ method: 'delete',
+ maxBodyLength: Infinity,
+ url: '/api/users/{userId}',
+ headers: {
+
+
+ 'Authorization': 'Token '
+ }
+
+};
- await client.contacts.update('WAz8eIbvDR60rouK', {
- display_name: 'UncleFrank',
- })
- ```
+axios(config)
+.then((response) => {
+ console.log(JSON.stringify(response.data));
+})
+.catch((error) => {
+ console.log(error);
+});
+```
- ```python
- from protocol_api import ApiClient
+```python
+import requests
+import json
- client = ApiClient(token)
+url = "https://api.netbird.io/api/users/{userId}"
- client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
- ```
+headers = {
+
+
+ 'Authorization': 'Token '
+}
- ```php
- $client = new \Protocol\ApiClient($token);
+response = requests.request("DELETE", url, headers=headers)
- $client->contacts->update('WAz8eIbvDR60rouK', [
- 'display_name' => 'UncleFrank',
- ]);
- ```
+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::Post.new(url)
+
+
+request["Authorization"] = "Token "
+
+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, '');
+Request request = new Request.Builder()
+ .url("https://api.netbird.io/api/users/{userId}")
+ .method("DELETE", body)
+
+
+ .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_POSTFIELDS =>'',
+ CURLOPT_HTTPHEADER => array(
+
+
+ 'Authorization: Token '
+ ),
+));
+
+$response = curl_exec($curl);
+
+curl_close($curl);
+echo $response;
+```