mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-16 07:26:35 +00:00
add pat and service user docs + remove empty lines from examples
This commit is contained in:
@@ -62,13 +62,13 @@ export const title = '<%- tag %>'
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="<%- operation.operation.toUpperCase() %>" label="<%- operation.path %>">
|
||||
\`\`\`bash {{ title: 'cURL' }}
|
||||
<% if(true){ -%>
|
||||
curl -X <%- operation.operation.toUpperCase() %> <%- operation.fullPath %> \\
|
||||
-H "Authorization: Token <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']){ -%>
|
||||
-H 'Content-Type: application/json' \\
|
||||
--data-raw '<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) %>'<% }; %>
|
||||
-H "Authorization: Token <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']){ %>
|
||||
-H 'Content-Type: application/json' \\\n--data-raw '<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) -%>'<% }; %>
|
||||
\`\`\`
|
||||
|
||||
\`\`\`js
|
||||
@@ -80,11 +80,13 @@ 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',<% }; %>
|
||||
<% if(true){%>headers: { <% }; -%>
|
||||
<% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ %>
|
||||
'Accept': 'application/json',<% }; -%>
|
||||
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
|
||||
'Content-Type': 'application/json',<% }; %>
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>,<% }; %>
|
||||
<% if(true){ -%>}<% }; -%><% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>,<% }; -%>
|
||||
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
|
||||
data : data<% }; %>
|
||||
};
|
||||
@@ -106,9 +108,11 @@ url = "<%- operation.fullPath %>"
|
||||
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
|
||||
payload = json.dumps(<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) %>)<% }; -%>
|
||||
|
||||
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',<% }; %>
|
||||
<% if(true){%>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 <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -141,10 +145,12 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
<% if(true){%>{<% }; -%>
|
||||
|
||||
<% 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")<% }; %>
|
||||
<% 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 <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -173,9 +179,11 @@ url = URI("<%- operation.fullPath %>")
|
||||
https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::<%- operation.operation.slice(0,1).toUpperCase() + operation.operation.slice(1).toLowerCase()%>.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"<% }; %>
|
||||
<% if(true){ %>request = Net::HTTP::<%- operation.operation.slice(0,1).toUpperCase() + operation.operation.slice(1).toLowerCase()%>.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 <TOKEN>"
|
||||
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
|
||||
request.body = JSON.dump(<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) %>)<% }; -%>
|
||||
@@ -192,9 +200,11 @@ MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, '<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) %>');<% }; %>
|
||||
Request request = new Request.Builder()
|
||||
.url("<%- operation.fullPath %>")
|
||||
.method("<%- operation.operation.toUpperCase() %>"<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>, 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")<% }; %>
|
||||
<% if(true){ %>.method("<%- operation.operation.toUpperCase() %>"<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>, 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 <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -213,12 +223,14 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => '<%- operation.operation.toUpperCase() %>',
|
||||
<% if(true){ %>CURLOPT_CUSTOMREQUEST => '<%- operation.operation.toUpperCase() %>',<% }; -%>
|
||||
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
|
||||
CURLOPT_POSTFIELDS =>'<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, 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',<% }; %>
|
||||
CURLOPT_POSTFIELDS => '<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) %>',<% }; %>
|
||||
<% if(true){ %>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 <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
BIN
public/img/overview/personal-access-token-creation.png
Normal file
BIN
public/img/overview/personal-access-token-creation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
BIN
public/img/overview/personal-access-token-example.png
Normal file
BIN
public/img/overview/personal-access-token-example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
BIN
public/img/overview/personal-access-token-overview.png
Normal file
BIN
public/img/overview/personal-access-token-overview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
BIN
public/img/overview/service-user-creation.png
Normal file
BIN
public/img/overview/service-user-creation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
BIN
public/img/overview/service-user-overview.png
Normal file
BIN
public/img/overview/service-user-overview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
55
src/components/How-NetBird-Works.jsx
Normal file
55
src/components/How-NetBird-Works.jsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { Button } from '@/components/Button'
|
||||
import { Heading } from '@/components/Heading'
|
||||
|
||||
const howNetbirdWorks = [
|
||||
{
|
||||
href: 'docs/how-netbird-works#architecture',
|
||||
name: 'Architecture',
|
||||
description: 'Learn everything there is to know about the general architecture of NetBird.',
|
||||
},
|
||||
{
|
||||
href: '/docs/how-netbird-works#general-flow-overview',
|
||||
name: 'General Flow Overview',
|
||||
description:
|
||||
'Learn how the general communication between components within the NetBird Cloud works.',
|
||||
},
|
||||
{
|
||||
href: '/docs/how-netbird-works#setup-keys',
|
||||
name: 'Setup Keys',
|
||||
description:
|
||||
'Learn about different kinds of setup keys and how to us them to add peers to your network.',
|
||||
},
|
||||
{
|
||||
href: '/docs/how-netbird-works#access-control',
|
||||
name: 'Access Control',
|
||||
description:
|
||||
'Learn how to limit communication between different peer groups inside your network.',
|
||||
},
|
||||
]
|
||||
|
||||
export function HowNetbirdWorks() {
|
||||
return (
|
||||
<div className="my-16 xl:max-w-none">
|
||||
<Heading level={2} id="howNetbirdWorks">
|
||||
How NetBird Works
|
||||
</Heading>
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-zinc-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4">
|
||||
{howNetbirdWorks.map((guide) => (
|
||||
<div key={guide.href}>
|
||||
<h3 className="text-sm font-semibold text-zinc-900 dark:text-white">
|
||||
{guide.name}
|
||||
</h3>
|
||||
<p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
{guide.description}
|
||||
</p>
|
||||
<p className="mt-4">
|
||||
<Button href={guide.href} variant="text" arrow="right">
|
||||
Read more
|
||||
</Button>
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -198,7 +198,6 @@ export const docsNavigation = [
|
||||
title: 'How-to Guides',
|
||||
links: [
|
||||
{ title: 'Getting Started', href: '/docs/getting-started' },
|
||||
{ title: 'Client Installation', href: '/docs/client-installation' },
|
||||
{ title: 'Managing your Network', href: '/docs/managing-your-network' },
|
||||
{ title: 'Examples', href: '/docs/examples' },
|
||||
{ title: 'CLI', href: '/docs/cli' },
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Accounts'
|
||||
curl -X GET https://api.netbird.io/api/accounts \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/accounts',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/accounts"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/accounts")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -263,12 +254,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/accounts/{accountId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -290,8 +280,8 @@ payload = json.dumps({
|
||||
"peer_login_expiration_enabled": true,
|
||||
"peer_login_expiration": 43200
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -327,9 +317,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -382,8 +372,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/accounts/{accountId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -403,14 +393,13 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"peer_login_expiration_enabled": true,
|
||||
"peer_login_expiration": 43200
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {HeroPattern} from "@/components/HeroPattern";
|
||||
export const description =
|
||||
'In this guide, we’ll look at how authentication works. Protocol offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token.'
|
||||
'In this guide, we’ll look at how authentication works. NetBird offers two ways to authenticate your API requests: OAuth2 and personal access tokens.'
|
||||
|
||||
<HeroPattern/>
|
||||
|
||||
# Authentication
|
||||
|
||||
You'll need to authenticate your requests to access any of the endpoints in the Protocol API. In this guide, we'll look at how authentication works. Protocol offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token — OAuth2 is the recommended way. {{ className: 'lead' }}
|
||||
You'll need to authenticate your requests to access any of the endpoints in the NetBird API. In this guide, we'll look at how authentication works. Netbird offers two ways to authenticate your API requests: OAuth2 and personal access tokens (PAT). {{ className: 'lead' }}
|
||||
|
||||
## OAuth2 with bearer token
|
||||
|
||||
The recommended way to authenticate with the Protocol API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — you will find it in the [Protocol dashboard](#) under API settings. Here's how to add the token to the request header using cURL:
|
||||
When establishing a connection using OAuth2, you will need your access token — you can retrieve one from your IDP manager. Here's how to add the token to the request header using cURL:
|
||||
|
||||
```bash {{ title: 'Example request with bearer token' }}
|
||||
curl https://api.netbird.io/api/users \
|
||||
@@ -21,7 +21,7 @@ Always keep your token safe and reset it if you suspect it has been compromised.
|
||||
|
||||
## Using personal access tokens
|
||||
|
||||
The recommended way to authenticate with the Protocol API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — you will find it in the [Protocol dashboard](#) under API settings. Here's how to add the token to the request header using cURL:
|
||||
When establishing a connection using [PATs](/docs/how-netbird-works#personal-access-tokens), you will need your access token — you can create one in the [Netbird dashboard](#) under User settings. It is recommended to use [service users](/docs/how-netbird-works#service-users) for all organization wide flows calling the API. Here's how to add the token to the request header using cURL:
|
||||
|
||||
```bash {{ title: 'Example request with personal access token' }}
|
||||
curl https://api.netbird.io/api/users \
|
||||
@@ -31,6 +31,6 @@ curl https://api.netbird.io/api/users \
|
||||
Always keep your token safe and reset it if you suspect it has been compromised.
|
||||
|
||||
<div className="not-prose mb-16 mt-6 flex gap-3">
|
||||
<Button href="/quickstart" arrow="right" children="How to create tokens" />
|
||||
<Button href="/docs/how-netbird-works#personal-access-tokens" arrow="right" children="How to create tokens" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'DNS'
|
||||
curl -X GET https://api.netbird.io/api/dns/nameservers \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/nameservers',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/dns/nameservers"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/nameservers")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -354,12 +345,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/nameservers',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -396,8 +386,8 @@ payload = json.dumps({
|
||||
"example.com"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -448,9 +438,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -533,8 +523,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/nameservers")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -554,9 +544,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "Google DNS",
|
||||
"description": "Google DNS servers",
|
||||
"nameservers": [
|
||||
@@ -575,8 +564,8 @@ curl_setopt_array($curl, array(
|
||||
"example.com"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -670,7 +659,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -680,12 +668,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/nameservers/{nsgroupId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -703,8 +689,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -736,9 +721,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -769,7 +753,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -783,8 +766,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -804,10 +786,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1009,12 +989,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/nameservers/{nsgroupId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -1051,8 +1030,8 @@ payload = json.dumps({
|
||||
"example.com"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -1103,9 +1082,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1188,8 +1167,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1209,9 +1188,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "Google DNS",
|
||||
"description": "Google DNS servers",
|
||||
"nameservers": [
|
||||
@@ -1230,8 +1208,8 @@ curl_setopt_array($curl, array(
|
||||
"example.com"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1324,8 +1302,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/dns/nameservers/{nsgroupId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -1335,12 +1311,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/nameservers/{nsgroupId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -1358,9 +1331,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -1391,10 +1362,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -1424,8 +1393,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -1438,9 +1405,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -1459,11 +1424,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
@@ -1499,7 +1461,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/dns/settings \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -1509,12 +1470,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/settings',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -1532,8 +1491,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/dns/settings"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -1565,9 +1523,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1598,7 +1555,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -1612,8 +1568,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/settings")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1633,10 +1588,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1726,12 +1679,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/dns/settings',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -1754,8 +1706,8 @@ payload = json.dumps({
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -1792,9 +1744,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1849,8 +1801,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/dns/settings")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1870,15 +1822,14 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"disabled_management_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
import {HeroPattern} from "@/components/HeroPattern";
|
||||
|
||||
<HeroPattern />
|
||||
|
||||
export const title = 'Client Installation'
|
||||
|
||||
## Linux
|
||||
|
||||
**APT/Debian**
|
||||
1. Add the repository:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install ca-certificates curl gnupg -y
|
||||
curl -sSL https://pkgs.wiretrustee.com/debian/public.key | sudo gpg --dearmor --output /usr/share/keyrings/wiretrustee-archive-keyring.gpg
|
||||
echo 'deb [signed-by=/usr/share/keyrings/wiretrustee-archive-keyring.gpg] https://pkgs.wiretrustee.com/debian stable main' | sudo tee /etc/apt/sources.list.d/wiretrustee.list
|
||||
```
|
||||
2. Update APT's cache
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
```
|
||||
3. Install the package
|
||||
|
||||
```bash
|
||||
# for CLI only
|
||||
sudo apt-get install netbird
|
||||
# for GUI package
|
||||
sudo apt-get install netbird-ui
|
||||
```
|
||||
|
||||
**RPM/Red hat**
|
||||
|
||||
1. Add the repository:
|
||||
```bash
|
||||
cat <<EOF | sudo tee /etc/yum.repos.d/wiretrustee.repo
|
||||
[Wiretrustee]
|
||||
name=Wiretrustee
|
||||
baseurl=https://pkgs.wiretrustee.com/yum/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
gpgkey=https://pkgs.wiretrustee.com/yum/repodata/repomd.xml.key
|
||||
repo_gpgcheck=1
|
||||
EOF
|
||||
```
|
||||
2. Install the package
|
||||
```bash
|
||||
# for CLI only
|
||||
sudo yum install netbird
|
||||
# for GUI package
|
||||
sudo yum install netbird-ui
|
||||
```
|
||||
|
||||
**Fedora**
|
||||
|
||||
1. Create the repository file:
|
||||
```bash
|
||||
cat <<EOF | sudo tee /etc/yum.repos.d/wiretrustee.repo
|
||||
[Wiretrustee]
|
||||
name=Wiretrustee
|
||||
baseurl=https://pkgs.wiretrustee.com/yum/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
gpgkey=https://pkgs.wiretrustee.com/yum/repodata/repomd.xml.key
|
||||
repo_gpgcheck=1
|
||||
EOF
|
||||
```
|
||||
2. Import the file
|
||||
```bash
|
||||
sudo dnf config-manager --add-repo /etc/yum.repos.d/wiretrustee.repo
|
||||
```
|
||||
3. Install the package
|
||||
```bash
|
||||
# for CLI only
|
||||
sudo dnf install netbird
|
||||
# for GUI package
|
||||
sudo dnf install netbird-ui
|
||||
```
|
||||
|
||||
|
||||
**NixOS 22.11+/unstable**
|
||||
|
||||
1. Edit your [`configuration.nix`](https://nixos.org/manual/nixos/stable/index.html#sec-changing-config)
|
||||
|
||||
```nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.netbird.enable = true; # for netbird service & CLI
|
||||
environment.systemPackages = [ pkgs.netbird-ui ]; # for GUI
|
||||
}
|
||||
```
|
||||
2. Build and apply new configuration
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch
|
||||
```
|
||||
|
||||
## MacOS
|
||||
**Homebrew install**
|
||||
1. Download and install homebrew at https://brew.sh/
|
||||
2. If wiretrustee was previously installed with homebrew, you will need to run:
|
||||
```bash
|
||||
# Stop and uninstall daemon service:
|
||||
sudo wiretrustee service stop
|
||||
sudo wiretrustee service uninstall
|
||||
# unlik the app
|
||||
brew unlink wiretrustee
|
||||
```
|
||||
> netbird will copy any existing configuration from the Wiretrustee's default configuration paths to the new NetBird's default location
|
||||
|
||||
3. Install the client
|
||||
```bash
|
||||
# for CLI only
|
||||
brew install netbirdio/tap/netbird
|
||||
# for GUI package
|
||||
brew install --cask netbirdio/tap/netbird-ui
|
||||
```
|
||||
4. If you installed CLI only, you need to install and start the client daemon service:
|
||||
```bash
|
||||
sudo netbird service install
|
||||
sudo netbird service start
|
||||
```
|
||||
|
||||
## Windows
|
||||
1. Checkout NetBird [releases](https://github.com/netbirdio/netbird/releases/latest)
|
||||
2. Download the latest Windows release installer ```netbird_installer_<VERSION>_windows_amd64.exe``` (**Switch VERSION to the latest**):
|
||||
3. Proceed with the installation steps
|
||||
4. This will install the UI client in the C:\\Program Files\\NetBird and add the daemon service
|
||||
5. After installing, you can follow the steps from [Running NetBird with SSO Login](#Running-NetBird-with-SSO-Login) steps.
|
||||
> To uninstall the client and service, you can use Add/Remove programs
|
||||
|
||||
⚠️ In case of any issues with the connection on Windows check the firewall settings. With default Windows 11 firewall setup there could be connectivity issue related to egress traffic.
|
||||
|
||||
Recommended way is to add NetBird in firewall settings:
|
||||
|
||||
1. Go to "Control panel".
|
||||
2. Select "Windows Defender Firewall".
|
||||
3. Select "Advanced settings".
|
||||
4. Select "Outbound Rules" -> "New rule".
|
||||
5. In the new rule select "Program" and click "Next".
|
||||
6. Point to the NetBird installation exe file (usually in `C:\Program Files\NetBird\netbird.exe`) and click "Next".
|
||||
7. Select "Allow the connection" and click "Next".
|
||||
8. Select the network in which rule should be applied (Domain, Private, Public) according to your needs and click "Next".
|
||||
9. Provide rule name (e.g. "Netbird Egress Traffic") and click "Finish".
|
||||
10. Disconnect and connect to NetBird.
|
||||
|
||||
|
||||
### Binary Install
|
||||
**Installation from binary (CLI only)**
|
||||
|
||||
1. Checkout NetBird [releases](https://github.com/netbirdio/netbird/releases/latest)
|
||||
2. Download the latest release:
|
||||
```bash
|
||||
curl -L -o ./netbird_<VERSION>.tar.gz https://github.com/netbirdio/netbird/releases/download/v<VERSION>/netbird_<VERSION>_<OS>_<Arch>.tar.gz
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
You need to replace some variables from the URL above:
|
||||
|
||||
- Replace **VERSION** with the latest released verion.
|
||||
- Replace **OS** with "linux", "darwin" for MacOS or "windows"
|
||||
- Replace **Arch** with your target system CPU archtecture
|
||||
|
||||
</Note>
|
||||
|
||||
3. Decompress
|
||||
```bash
|
||||
tar xcf ./netbird_<VERSION>.tar.gz
|
||||
sudo mv netbird /usr/bin/netbird
|
||||
sudo chown root:root /usr/bin/netbird
|
||||
sudo chmod +x /usr/bin/netbird
|
||||
```
|
||||
After that you may need to add /usr/bin in your PATH environment variable:
|
||||
````bash
|
||||
export PATH=$PATH:/usr/bin
|
||||
````
|
||||
4. Install and run the service
|
||||
```bash
|
||||
sudo netbird service install
|
||||
sudo netbird service start
|
||||
```
|
||||
|
||||
### Running NetBird with SSO Login
|
||||
#### Desktop UI Application
|
||||
If you installed the Desktop UI client, you can launch it and click on Connect.
|
||||
> It will open your browser, and you will be prompt for email and password. Follow the instructions.
|
||||
|
||||
<p>
|
||||
<img src="/img/getting-started/netbird-sso-login-ui.gif" alt="high-level-dia" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
#### CLI
|
||||
Alternatively, you could use command line. Simply run
|
||||
```bash
|
||||
netbird up
|
||||
```
|
||||
> It will open your browser, and you will be prompt for email and password. Follow the instructions.
|
||||
|
||||
<p>
|
||||
<img src="/img/getting-started/netbird-sso-login-cmd.gif" alt="high-level-dia" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
Check connection status:
|
||||
```bash
|
||||
netbird status
|
||||
```
|
||||
|
||||
### Running NetBird with a Setup Key
|
||||
In case you are activating a server peer, you can use a [setup key](/overview/setup-keys) as described in the steps below.
|
||||
> This is especially helpful when you are running multiple server instances with infrastructure-as-code tools like ansible and terraform.
|
||||
|
||||
1. Login to the Management Service. You need to have a `setup key` in hand (see [setup keys](/overview/setup-keys)).
|
||||
|
||||
For all systems:
|
||||
```bash
|
||||
netbird up --setup-key <SETUP KEY>
|
||||
```
|
||||
|
||||
For **Docker**, you can run with the following command:
|
||||
```bash
|
||||
docker run --network host --privileged --rm -d -e NB_SETUP_KEY=<SETUP KEY> -v netbird-client:/etc/netbird netbirdio/netbird:<TAG>
|
||||
```
|
||||
> TAG > 0.6.0 version
|
||||
|
||||
Alternatively, if you are hosting your own Management Service provide `--management-url` property pointing to your Management Service:
|
||||
```bash
|
||||
netbird up --setup-key <SETUP KEY> --management-url http://localhost:33073
|
||||
```
|
||||
|
||||
> You could also omit the `--setup-key` property. In this case, the tool will prompt for the key.
|
||||
|
||||
2. Check connection status:
|
||||
```bash
|
||||
netbird status
|
||||
```
|
||||
|
||||
3. Check your IP:
|
||||
|
||||
On **macOS** :
|
||||
````bash
|
||||
sudo ifconfig utun100
|
||||
````
|
||||
On **Linux**:
|
||||
```bash
|
||||
ip addr show wt0
|
||||
```
|
||||
On **Windows**:
|
||||
```bash
|
||||
netsh interface ip show config name="wt0"
|
||||
```
|
||||
|
||||
### Running NetBird in Docker
|
||||
|
||||
Set the ```NB_SETUP_KEY``` environment variable and run the command.
|
||||
<Note>
|
||||
You can pass other settings as environment variables. See [Environment variables](reference/netbird-commands.md#environment-variables) for details.
|
||||
</Note>
|
||||
```bash
|
||||
docker run --rm --name PEER_NAME --hostname PEER_NAME --cap-add=NET_ADMIN -d -e NB_SETUP_KEY=<SETUP KEY> -v netbird-client:/etc/netbird netbirdio/netbird:latest
|
||||
```
|
||||
|
||||
See [Docker example](examples/netbird-docker.md) for details.
|
||||
|
||||
### Troubleshooting
|
||||
1. If you are using self-hosted version and haven't specified `--management-url`, the client app will use the default URL
|
||||
which is ```https://api.wiretrustee.com:33073```.
|
||||
|
||||
2. If you have specified a wrong `--management-url` (e.g., just by mistake when self-hosting)
|
||||
to override it you can do the following:
|
||||
|
||||
```bash
|
||||
netbird down
|
||||
netbird up --management-url https://<CORRECT HOST:PORT>/
|
||||
```
|
||||
|
||||
To override it see the solution #1 above.
|
||||
|
||||
@@ -2,7 +2,9 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp
|
||||
|
||||
<HeroPattern />
|
||||
|
||||
# Getting Started
|
||||
export const title = 'Getting Started'
|
||||
|
||||
## Quickstart Guide
|
||||
|
||||
Step-by-step video guide on YouTube:
|
||||
|
||||
@@ -72,3 +74,277 @@ ping 100.64.0.1
|
||||
- Follow us [on Twitter](https://twitter.com/netbird)
|
||||
- Join our [Slack Channel](https://join.slack.com/t/netbirdio/shared_invite/zt-vrahf41g-ik1v7fV8du6t0RwxSrJ96A)
|
||||
- NetBird release page on GitHub: [releases](https://github.com/netbirdio/netbird/releases/latest)
|
||||
|
||||
## Installation
|
||||
|
||||
### Linux
|
||||
|
||||
**APT/Debian**
|
||||
1. Add the repository:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install ca-certificates curl gnupg -y
|
||||
curl -sSL https://pkgs.wiretrustee.com/debian/public.key | sudo gpg --dearmor --output /usr/share/keyrings/wiretrustee-archive-keyring.gpg
|
||||
echo 'deb [signed-by=/usr/share/keyrings/wiretrustee-archive-keyring.gpg] https://pkgs.wiretrustee.com/debian stable main' | sudo tee /etc/apt/sources.list.d/wiretrustee.list
|
||||
```
|
||||
2. Update APT's cache
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
```
|
||||
3. Install the package
|
||||
|
||||
```bash
|
||||
# for CLI only
|
||||
sudo apt-get install netbird
|
||||
# for GUI package
|
||||
sudo apt-get install netbird-ui
|
||||
```
|
||||
|
||||
**RPM/Red hat**
|
||||
|
||||
1. Add the repository:
|
||||
```bash
|
||||
cat <<EOF | sudo tee /etc/yum.repos.d/wiretrustee.repo
|
||||
[Wiretrustee]
|
||||
name=Wiretrustee
|
||||
baseurl=https://pkgs.wiretrustee.com/yum/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
gpgkey=https://pkgs.wiretrustee.com/yum/repodata/repomd.xml.key
|
||||
repo_gpgcheck=1
|
||||
EOF
|
||||
```
|
||||
2. Install the package
|
||||
```bash
|
||||
# for CLI only
|
||||
sudo yum install netbird
|
||||
# for GUI package
|
||||
sudo yum install netbird-ui
|
||||
```
|
||||
|
||||
**Fedora**
|
||||
|
||||
1. Create the repository file:
|
||||
```bash
|
||||
cat <<EOF | sudo tee /etc/yum.repos.d/wiretrustee.repo
|
||||
[Wiretrustee]
|
||||
name=Wiretrustee
|
||||
baseurl=https://pkgs.wiretrustee.com/yum/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
gpgkey=https://pkgs.wiretrustee.com/yum/repodata/repomd.xml.key
|
||||
repo_gpgcheck=1
|
||||
EOF
|
||||
```
|
||||
2. Import the file
|
||||
```bash
|
||||
sudo dnf config-manager --add-repo /etc/yum.repos.d/wiretrustee.repo
|
||||
```
|
||||
3. Install the package
|
||||
```bash
|
||||
# for CLI only
|
||||
sudo dnf install netbird
|
||||
# for GUI package
|
||||
sudo dnf install netbird-ui
|
||||
```
|
||||
|
||||
|
||||
**NixOS 22.11+/unstable**
|
||||
|
||||
1. Edit your [`configuration.nix`](https://nixos.org/manual/nixos/stable/index.html#sec-changing-config)
|
||||
|
||||
```nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.netbird.enable = true; # for netbird service & CLI
|
||||
environment.systemPackages = [ pkgs.netbird-ui ]; # for GUI
|
||||
}
|
||||
```
|
||||
2. Build and apply new configuration
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch
|
||||
```
|
||||
|
||||
### macOS
|
||||
**Homebrew install**
|
||||
1. Download and install homebrew at https://brew.sh/
|
||||
2. If wiretrustee was previously installed with homebrew, you will need to run:
|
||||
```bash
|
||||
# Stop and uninstall daemon service:
|
||||
sudo wiretrustee service stop
|
||||
sudo wiretrustee service uninstall
|
||||
# unlik the app
|
||||
brew unlink wiretrustee
|
||||
```
|
||||
> netbird will copy any existing configuration from the Wiretrustee's default configuration paths to the new NetBird's default location
|
||||
|
||||
3. Install the client
|
||||
```bash
|
||||
# for CLI only
|
||||
brew install netbirdio/tap/netbird
|
||||
# for GUI package
|
||||
brew install --cask netbirdio/tap/netbird-ui
|
||||
```
|
||||
4. If you installed CLI only, you need to install and start the client daemon service:
|
||||
```bash
|
||||
sudo netbird service install
|
||||
sudo netbird service start
|
||||
```
|
||||
|
||||
### Windows
|
||||
1. Checkout NetBird [releases](https://github.com/netbirdio/netbird/releases/latest)
|
||||
2. Download the latest Windows release installer ```netbird_installer_<VERSION>_windows_amd64.exe``` (**Switch VERSION to the latest**):
|
||||
3. Proceed with the installation steps
|
||||
4. This will install the UI client in the C:\\Program Files\\NetBird and add the daemon service
|
||||
5. After installing, you can follow the steps from [Running NetBird with SSO Login](#Running-NetBird-with-SSO-Login) steps.
|
||||
> To uninstall the client and service, you can use Add/Remove programs
|
||||
|
||||
⚠️ In case of any issues with the connection on Windows check the firewall settings. With default Windows 11 firewall setup there could be connectivity issue related to egress traffic.
|
||||
|
||||
Recommended way is to add NetBird in firewall settings:
|
||||
|
||||
1. Go to "Control panel".
|
||||
2. Select "Windows Defender Firewall".
|
||||
3. Select "Advanced settings".
|
||||
4. Select "Outbound Rules" -> "New rule".
|
||||
5. In the new rule select "Program" and click "Next".
|
||||
6. Point to the NetBird installation exe file (usually in `C:\Program Files\NetBird\netbird.exe`) and click "Next".
|
||||
7. Select "Allow the connection" and click "Next".
|
||||
8. Select the network in which rule should be applied (Domain, Private, Public) according to your needs and click "Next".
|
||||
9. Provide rule name (e.g. "Netbird Egress Traffic") and click "Finish".
|
||||
10. Disconnect and connect to NetBird.
|
||||
|
||||
|
||||
### Binary Install
|
||||
**Installation from binary (CLI only)**
|
||||
|
||||
1. Checkout NetBird [releases](https://github.com/netbirdio/netbird/releases/latest)
|
||||
2. Download the latest release:
|
||||
```bash
|
||||
curl -L -o ./netbird_<VERSION>.tar.gz https://github.com/netbirdio/netbird/releases/download/v<VERSION>/netbird_<VERSION>_<OS>_<Arch>.tar.gz
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
You need to replace some variables from the URL above:
|
||||
|
||||
- Replace **VERSION** with the latest released verion.
|
||||
- Replace **OS** with "linux", "darwin" for MacOS or "windows"
|
||||
- Replace **Arch** with your target system CPU archtecture
|
||||
|
||||
</Note>
|
||||
|
||||
3. Decompress
|
||||
```bash
|
||||
tar xcf ./netbird_<VERSION>.tar.gz
|
||||
sudo mv netbird /usr/bin/netbird
|
||||
sudo chown root:root /usr/bin/netbird
|
||||
sudo chmod +x /usr/bin/netbird
|
||||
```
|
||||
After that you may need to add /usr/bin in your PATH environment variable:
|
||||
````bash
|
||||
export PATH=$PATH:/usr/bin
|
||||
````
|
||||
4. Install and run the service
|
||||
```bash
|
||||
sudo netbird service install
|
||||
sudo netbird service start
|
||||
```
|
||||
|
||||
### Running NetBird with SSO Login
|
||||
#### Desktop UI Application
|
||||
If you installed the Desktop UI client, you can launch it and click on Connect.
|
||||
> It will open your browser, and you will be prompt for email and password. Follow the instructions.
|
||||
|
||||
<p>
|
||||
<img src="/img/getting-started/netbird-sso-login-ui.gif" alt="high-level-dia" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
#### CLI
|
||||
Alternatively, you could use command line. Simply run
|
||||
```bash
|
||||
netbird up
|
||||
```
|
||||
> It will open your browser, and you will be prompt for email and password. Follow the instructions.
|
||||
|
||||
<p>
|
||||
<img src="/img/getting-started/netbird-sso-login-cmd.gif" alt="high-level-dia" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
Check connection status:
|
||||
```bash
|
||||
netbird status
|
||||
```
|
||||
|
||||
### Running NetBird with a Setup Key
|
||||
In case you are activating a server peer, you can use a [setup key](/overview/setup-keys) as described in the steps below.
|
||||
> This is especially helpful when you are running multiple server instances with infrastructure-as-code tools like ansible and terraform.
|
||||
|
||||
1. Login to the Management Service. You need to have a `setup key` in hand (see [setup keys](/overview/setup-keys)).
|
||||
|
||||
For all systems:
|
||||
```bash
|
||||
netbird up --setup-key <SETUP KEY>
|
||||
```
|
||||
|
||||
For **Docker**, you can run with the following command:
|
||||
```bash
|
||||
docker run --network host --privileged --rm -d -e NB_SETUP_KEY=<SETUP KEY> -v netbird-client:/etc/netbird netbirdio/netbird:<TAG>
|
||||
```
|
||||
> TAG > 0.6.0 version
|
||||
|
||||
Alternatively, if you are hosting your own Management Service provide `--management-url` property pointing to your Management Service:
|
||||
```bash
|
||||
netbird up --setup-key <SETUP KEY> --management-url http://localhost:33073
|
||||
```
|
||||
|
||||
> You could also omit the `--setup-key` property. In this case, the tool will prompt for the key.
|
||||
|
||||
2. Check connection status:
|
||||
```bash
|
||||
netbird status
|
||||
```
|
||||
|
||||
3. Check your IP:
|
||||
|
||||
On **macOS** :
|
||||
````bash
|
||||
sudo ifconfig utun100
|
||||
````
|
||||
On **Linux**:
|
||||
```bash
|
||||
ip addr show wt0
|
||||
```
|
||||
On **Windows**:
|
||||
```bash
|
||||
netsh interface ip show config name="wt0"
|
||||
```
|
||||
|
||||
### Running NetBird in Docker
|
||||
|
||||
Set the ```NB_SETUP_KEY``` environment variable and run the command.
|
||||
<Note>
|
||||
You can pass other settings as environment variables. See [Environment variables](reference/netbird-commands.md#environment-variables) for details.
|
||||
</Note>
|
||||
```bash
|
||||
docker run --rm --name PEER_NAME --hostname PEER_NAME --cap-add=NET_ADMIN -d -e NB_SETUP_KEY=<SETUP KEY> -v netbird-client:/etc/netbird netbirdio/netbird:latest
|
||||
```
|
||||
|
||||
See [Docker example](examples/netbird-docker.md) for details.
|
||||
|
||||
### Troubleshooting
|
||||
1. If you are using self-hosted version and haven't specified `--management-url`, the client app will use the default URL
|
||||
which is ```https://api.wiretrustee.com:33073```.
|
||||
|
||||
2. If you have specified a wrong `--management-url` (e.g., just by mistake when self-hosting)
|
||||
to override it you can do the following:
|
||||
|
||||
```bash
|
||||
netbird down
|
||||
netbird up --management-url https://<CORRECT HOST:PORT>/
|
||||
```
|
||||
|
||||
To override it see the solution #1 above.
|
||||
|
||||
@@ -318,3 +318,82 @@ To delete a rule, you should click on the rule's menu and choose `Delete`. A con
|
||||
<p align="center">
|
||||
<img src="/img/overview/delete-rule-popup.png" alt="high-level-dia" width="300" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
## Service Users
|
||||
|
||||
Service users are a type of account that allow applications or services to access resources and perform actions within your organization.
|
||||
|
||||
### What are Service Users used for?
|
||||
|
||||
Service users are typically used to authenticate requests to a web service on behalf of an application or a service. They are an alternative to using a personal account, and can provide additional security by allowing you to limit the scope of access granted to the service user.
|
||||
|
||||
Service users can be used in a variety of scenarios, including:
|
||||
|
||||
- **Automated scripts**: If you need to run automated scripts that access resources within your organization, you can use service users instead of storing your login credentials in plain text.
|
||||
- **Third-party integrations**: If you want to integrate your resources with a third-party service, you can use a service user to provide access to your data without giving the third-party service access to your personal account.
|
||||
- **Access control**: If you need to grant access to a specific set of resources to a particular application or service, you can create a service user with the necessary permissions.
|
||||
|
||||
### Creating a Service User
|
||||
|
||||
To create a service user, you'll need to log in to your organization's account and navigate to the "Service Users" section of your account settings.
|
||||
<p align="center">
|
||||
<img src="/img/overview/service-user-overview.png" alt="service-user-overview" width="780" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
From there, you can create a new service user and specify the permissions that the user should have.
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/overview/service-user-creation.png" alt="service-user-creation-popup" width="400" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
<Note>
|
||||
It's important to keep your service users secure, as they can provide access to sensitive data and actions within your organization. You should treat your service users like you would treat your own personal account and limit the scope of access granted to the service user.
|
||||
</Note>
|
||||
|
||||
|
||||
## Personal Access Tokens
|
||||
|
||||
Personal access tokens are a type of authentication credential that allow you to access your account and perform actions on behalf of yourself or your organization.
|
||||
|
||||
### What are Personal Access Tokens used for?
|
||||
|
||||
Personal access tokens are typically used to authenticate API requests to a web service. They are an alternative to using your username and password, and can provide additional security by allowing you to limit the scope of access granted to the token.
|
||||
|
||||
Personal access tokens can be used in a variety of scenarios, including:
|
||||
|
||||
- **Automated scripts**: If you need to run automated scripts that access your account, you can use personal access tokens instead of storing your login credentials in plain text.
|
||||
- **Third-party integrations**: If you want to integrate your account with a third-party service, you can use a personal access token to provide access to your data without giving the third-party service your login credentials.
|
||||
- **Command-line tools**: If you use command-line tools to interact with your account, you can use personal access tokens to authenticate those requests.
|
||||
|
||||
### Creating a Personal Access Token
|
||||
|
||||
To create a personal access token, you'll need to log in to your account and navigate to the "Users" section and look for your user or create a [service user](#) to use for your API requests.
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/overview/personal-access-token-overview.png" alt="personal-access-token-overview" width="780" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
From there, you can create a new token and specify the permissions that the token should have.
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/overview/personal-access-token-creation.png" alt="personal-access-creation-popup" width="400" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
After the token was generated successfully you will see a plain version of your token to copy and store in a secure place.
|
||||
Be aware that once you close the popup it is impossible to see the plain version of the token again as NetBird only stores a hashed version of the token.
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/overview/personal-access-token-example.png" alt="personal-access-token-example" width="400" style={{boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'}} />
|
||||
</p>
|
||||
|
||||
<Note>
|
||||
It's important to keep your personal access tokens secure, as they can provide access to sensitive data and actions within your account. You should treat your personal access tokens like you would treat your password and never share them with anyone else.
|
||||
</Note>
|
||||
|
||||
### Using Personal Access Tokens
|
||||
|
||||
Once you have created a personal access token, you can use it to authenticate requests to a web service that supports token-based authentication. To use a personal access token, you typically include it as an authentication header in your API requests.
|
||||
|
||||
For example, if you were using the GitHub API, you might include your personal access token like this:
|
||||
|
||||
With this header included, the GitHub API would authenticate your request using your personal access token and grant you access to the resources that the token has been authorized to access.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { HeroPattern } from '@/components/HeroPattern'
|
||||
|
||||
import { Clients } from '@/components/Clients'
|
||||
import {Note} from "@/components/mdx"
|
||||
import {HowToGuides} from "@/components/How-To-Guides";
|
||||
import {HowToGuides} from "@/components/How-To-Guides"
|
||||
import {HowNetbirdWorks} from "@/components/How-NetBird-Works"
|
||||
|
||||
export const description =
|
||||
'Learn everything there is to know about NetBird.'
|
||||
@@ -29,4 +29,4 @@ It literally takes less than 5 minutes to deploy a secure peer-to-peer VPN with
|
||||
|
||||
<HowToGuides />
|
||||
|
||||
<Clients />
|
||||
<HowNetbirdWorks />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {HeroPattern} from "@/components/HeroPattern";
|
||||
import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/components/mdx";
|
||||
export const description =
|
||||
'In this guide, we will talk about what happens when something goes wrong while you work with the API.'
|
||||
|
||||
@@ -6,65 +6,31 @@ export const description =
|
||||
|
||||
# Errors
|
||||
|
||||
In this guide, we will talk about what happens when something goes wrong while you work with the API. Mistakes happen, and mostly they will be yours, not ours. Let's look at some status codes and error types you might encounter. {{ className: 'lead' }}
|
||||
When working with APIs, it's important to understand the different types of HTTP errors that you might encounter. These errors can help you diagnose issues with your API requests and determine how to resolve them. {{ className: 'lead' }}
|
||||
|
||||
You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging (before contacting support).
|
||||
You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging.
|
||||
|
||||
<Note>
|
||||
Before reaching out to support with an error, please be aware that 99% of all
|
||||
reported errors are, in fact, user errors. Therefore, please carefully check
|
||||
your code before contacting Protocol support.
|
||||
The API is still in Beta state so some errors might not be handled properly yet.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Status codes
|
||||
|
||||
Here is a list of the different categories of status codes returned by the Protocol API. Use these to understand if a request was successful.
|
||||
Here is a list of the different categories of status codes returned by the NetBird API. Use these to understand if a request was successful.
|
||||
|
||||
<Properties>
|
||||
<Property name="2xx">
|
||||
A 2xx status code indicates a successful response.
|
||||
</Property>
|
||||
<Property name="4xx">
|
||||
A 4xx status code indicates a client error — this means it's a _you_
|
||||
problem.
|
||||
A 4xx status code indicates a client error - those are mostly related to missing permissions or invalid parameters inside the request.
|
||||
</Property>
|
||||
<Property name="5xx">
|
||||
A 5xx status code indicates a server error — you won't be seeing these.
|
||||
A 5xx status code indicates a server error - in this case please reach out to us via [Slack](https://join.slack.com/t/netbirdio/shared_invite/zt-vrahf41g-ik1v7fV8du6t0RwxSrJ96A) or [GitHub](https://github.com/netbirdio/netbird/issues).
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
---
|
||||
|
||||
## Error types
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
|
||||
Whenever a request is unsuccessful, the Protocol API will return an error response with an error type and message. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.
|
||||
|
||||
Here is a list of the two error types supported by the Protocol API — use these to understand what you have done wrong.
|
||||
|
||||
<Properties>
|
||||
<Property name="api_error">
|
||||
This means that we made an error, which is highly speculative and unlikely.
|
||||
</Property>
|
||||
<Property name="invalid_request">
|
||||
This means that you made an error, which is much more likely.
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
</Col>
|
||||
<Col>
|
||||
|
||||
```bash {{ title: "Error response" }}
|
||||
{
|
||||
"type": "api_error",
|
||||
"message": "No way this is happening!?",
|
||||
"documentation_url": "https://protocol.chat/docs/errors/api_error"
|
||||
}
|
||||
```
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Events'
|
||||
curl -X GET https://api.netbird.io/api/events \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/events',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/events"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/events")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Groups'
|
||||
curl -X GET https://api.netbird.io/api/groups \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/groups',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/groups"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/groups")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -267,12 +258,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/groups',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -296,8 +286,8 @@ payload = json.dumps({
|
||||
null
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -335,9 +325,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -394,8 +384,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/groups")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -415,16 +405,15 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "devs",
|
||||
"peers": [
|
||||
null
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -500,7 +489,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/groups/{groupId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -510,12 +498,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/groups/{groupId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -533,8 +519,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/groups/{groupId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -566,9 +551,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -599,7 +583,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -613,8 +596,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/groups/{groupId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -634,10 +616,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -752,12 +732,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/groups/{groupId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -781,8 +760,8 @@ payload = json.dumps({
|
||||
null
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -820,9 +799,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -879,8 +858,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/groups/{groupId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -900,16 +879,15 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "devs",
|
||||
"peers": [
|
||||
null
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -984,8 +962,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/groups/{groupId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -995,12 +971,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/groups/{groupId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -1018,9 +991,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/groups/{groupId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -1051,10 +1022,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -1084,8 +1053,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -1098,9 +1065,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/groups/{groupId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -1119,11 +1084,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -5,11 +5,6 @@ import { HeroPattern } from '@/components/HeroPattern'
|
||||
export const description =
|
||||
'Learn everything there is to know about the NetBird Public API.'
|
||||
|
||||
export const sections = [
|
||||
{ title: 'Guides', id: 'guides' },
|
||||
{ title: 'Resources', id: 'resources' },
|
||||
]
|
||||
|
||||
<HeroPattern />
|
||||
|
||||
# NetBird REST API
|
||||
@@ -18,17 +13,16 @@ Use the NetBird Public API to manage users, peers, network rules and more from i
|
||||
|
||||
<div className="not-prose mb-16 mt-6 flex gap-3">
|
||||
<Button href="/quickstart" arrow="right" children="Quickstart" />
|
||||
<Button href="/sdks" variant="outline" children="Explore SDKs" />
|
||||
</div>
|
||||
|
||||
## Getting started {{ anchor: false }}
|
||||
|
||||
To get started, it is recommended to create a [service user](#), that can later be used to communicate with the NetBird API.
|
||||
To be able to send requests to our API you need [authenticate](#) on each request. This can be done either by Bearer token from you identity provider or by creating [personal access tokens](#) in the NetBird dashboard.{{ className: 'lead' }}
|
||||
To get started, it is recommended to create a [service user](/docs/how-netbird-works#service-users), that can later be used to communicate with the NetBird API.
|
||||
To be able to send requests to our API you need to [authenticate](/authentication) on each request. This can be done either by Bearer token from your identity provider or by creating a [personal access token](/docs/how-netbird-works#personal-access-tokens) in the NetBird dashboard.{{ className: 'lead' }}
|
||||
|
||||
<div className="not-prose">
|
||||
<Button
|
||||
href="/sdks"
|
||||
href="/docs/how-netbird-works#personal-access-tokens"
|
||||
variant="text"
|
||||
arrow="right"
|
||||
children="Get your personal access token"
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Peers'
|
||||
curl -X GET https://api.netbird.io/api/peers \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/peers',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/peers"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/peers")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -262,7 +253,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/peers/{peerId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -272,12 +262,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/peers/{peerId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -295,8 +283,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/peers/{peerId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -328,9 +315,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -361,7 +347,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -375,8 +360,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/peers/{peerId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -396,10 +380,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -545,12 +527,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/peers/{peerId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -573,8 +554,8 @@ payload = json.dumps({
|
||||
"ssh_enabled": true,
|
||||
"login_expiration_enabled": false
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -611,9 +592,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -668,8 +649,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/peers/{peerId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -689,15 +670,14 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "stage-host-1",
|
||||
"ssh_enabled": true,
|
||||
"login_expiration_enabled": false
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -798,8 +778,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/peers/{peerId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -809,12 +787,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/peers/{peerId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -832,9 +807,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/peers/{peerId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -865,10 +838,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -898,8 +869,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -912,9 +881,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/peers/{peerId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -933,11 +900,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Policies'
|
||||
curl -X GET https://api.netbird.io/api/policies \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/policies',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/policies"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/policies")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -372,12 +363,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/policies',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -424,8 +414,8 @@ payload = json.dumps({
|
||||
}
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -486,9 +476,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -591,8 +581,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/policies")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -612,9 +602,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
@@ -643,8 +632,8 @@ curl_setopt_array($curl, array(
|
||||
}
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -754,7 +743,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/policies/{policyId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -764,12 +752,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/policies/{policyId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -787,8 +773,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/policies/{policyId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -820,9 +805,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -853,7 +837,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -867,8 +850,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/policies/{policyId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -888,10 +870,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1111,12 +1091,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/policies/{policyId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -1163,8 +1142,8 @@ payload = json.dumps({
|
||||
}
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -1225,9 +1204,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1330,8 +1309,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/policies/{policyId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1351,9 +1330,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
@@ -1382,8 +1360,8 @@ curl_setopt_array($curl, array(
|
||||
}
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1496,8 +1474,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/policies/{policyId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -1507,12 +1483,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/policies/{policyId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -1530,9 +1503,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/policies/{policyId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -1563,10 +1534,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -1596,8 +1565,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -1610,9 +1577,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/policies/{policyId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -1631,11 +1596,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Routes'
|
||||
curl -X GET https://api.netbird.io/api/routes \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/routes',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/routes"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/routes")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -335,12 +326,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/routes',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -370,8 +360,8 @@ payload = json.dumps({
|
||||
"chacdk86lnnboviihd70"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -415,9 +405,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -486,8 +476,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/routes")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -507,9 +497,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"description": "My first route",
|
||||
"network_id": "Route 1",
|
||||
"enabled": true,
|
||||
@@ -521,8 +510,8 @@ curl_setopt_array($curl, array(
|
||||
"chacdk86lnnboviihd70"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -604,7 +593,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/routes/{routeId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -614,12 +602,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/routes/{routeId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -637,8 +623,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/routes/{routeId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -670,9 +655,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -703,7 +687,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -717,8 +700,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/routes/{routeId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -738,10 +720,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -924,12 +904,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/routes/{routeId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -959,8 +938,8 @@ payload = json.dumps({
|
||||
"chacdk86lnnboviihd70"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -1004,9 +983,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1075,8 +1054,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/routes/{routeId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1096,9 +1075,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"description": "My first route",
|
||||
"network_id": "Route 1",
|
||||
"enabled": true,
|
||||
@@ -1110,8 +1088,8 @@ curl_setopt_array($curl, array(
|
||||
"chacdk86lnnboviihd70"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1192,8 +1170,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/routes/{routeId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -1203,12 +1179,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/routes/{routeId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -1226,9 +1199,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/routes/{routeId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -1259,10 +1230,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -1292,8 +1261,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -1306,9 +1273,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/routes/{routeId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -1327,11 +1292,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Rules'
|
||||
curl -X GET https://api.netbird.io/api/rules \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/rules',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/rules"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/rules")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -327,12 +318,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/rules',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -362,8 +352,8 @@ payload = json.dumps({
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -407,9 +397,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -478,8 +468,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/rules")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -499,9 +489,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"disabled": false,
|
||||
@@ -513,8 +502,8 @@ curl_setopt_array($curl, array(
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -606,7 +595,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/rules/{ruleId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -616,12 +604,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/rules/{ruleId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -639,8 +625,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/rules/{ruleId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -672,9 +657,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -705,7 +689,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -719,8 +702,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/rules/{ruleId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -740,10 +722,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -918,12 +898,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/rules/{ruleId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -953,8 +932,8 @@ payload = json.dumps({
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -998,9 +977,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1069,8 +1048,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/rules/{ruleId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1090,9 +1069,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"disabled": false,
|
||||
@@ -1104,8 +1082,8 @@ curl_setopt_array($curl, array(
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -1200,8 +1178,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/rules/{ruleId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -1211,12 +1187,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/rules/{ruleId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -1234,9 +1207,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/rules/{ruleId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -1267,10 +1238,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -1300,8 +1269,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -1314,9 +1281,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/rules/{ruleId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -1335,11 +1300,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -19,7 +19,6 @@ export const title = 'Setup Keys'
|
||||
curl -X GET https://api.netbird.io/api/setup-keys \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -29,12 +28,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/setup-keys',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -52,8 +49,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/setup-keys"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -85,9 +81,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -118,7 +113,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -132,8 +126,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/setup-keys")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -153,10 +146,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -315,12 +306,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/setup-keys',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -348,8 +338,8 @@ payload = json.dumps({
|
||||
],
|
||||
"usage_limit": 0
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -391,9 +381,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -458,8 +448,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/setup-keys")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -479,9 +469,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "Default key",
|
||||
"type": "reusable",
|
||||
"expires_in": 43200,
|
||||
@@ -491,8 +480,8 @@ curl_setopt_array($curl, array(
|
||||
],
|
||||
"usage_limit": 0
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -580,7 +569,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/setup-keys/{keyId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -590,12 +578,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/setup-keys/{keyId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -613,8 +599,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/setup-keys/{keyId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -646,9 +631,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -679,7 +663,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -693,8 +676,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/setup-keys/{keyId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -714,10 +696,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -880,12 +860,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/setup-keys/{keyId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -913,8 +892,8 @@ payload = json.dumps({
|
||||
],
|
||||
"usage_limit": 0
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -956,9 +935,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -1023,8 +1002,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/setup-keys/{keyId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -1044,9 +1023,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "Default key",
|
||||
"type": "reusable",
|
||||
"expires_in": 43200,
|
||||
@@ -1056,8 +1034,8 @@ curl_setopt_array($curl, array(
|
||||
],
|
||||
"usage_limit": 0
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
|
||||
@@ -27,7 +27,6 @@ export const title = 'Tokens'
|
||||
curl -X GET https://api.netbird.io/api/users/{userId}/tokens \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -37,12 +36,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users/{userId}/tokens',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -60,8 +57,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users/{userId}/tokens"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -93,9 +89,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -126,7 +121,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -140,8 +134,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}/tokens")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -161,10 +154,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -277,12 +268,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users/{userId}/tokens',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -304,8 +294,8 @@ payload = json.dumps({
|
||||
"name": "My first token",
|
||||
"expires_in": 30
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -341,9 +331,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -396,8 +386,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}/tokens")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -417,14 +407,13 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"name": "My first token",
|
||||
"expires_in": 30
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -504,7 +493,6 @@ echo $response;
|
||||
curl -X GET https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -514,12 +502,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users/{userId}/tokens/{tokenId}',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -537,8 +523,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users/{userId}/tokens/{tokenId}"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -570,9 +555,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -603,7 +587,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -617,8 +600,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -638,10 +620,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -714,8 +694,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -725,12 +703,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users/{userId}/tokens/{tokenId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -748,9 +723,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users/{userId}/tokens/{tokenId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -781,10 +754,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -814,8 +785,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -828,9 +797,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -849,11 +816,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -27,7 +27,6 @@ export const title = 'Users'
|
||||
curl -X GET https://api.netbird.io/api/users \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -37,12 +36,10 @@ let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users',
|
||||
headers: {
|
||||
|
||||
'Accept': 'application/json',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -60,8 +57,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users"
|
||||
|
||||
headers = {
|
||||
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -93,9 +89,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -126,7 +121,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
@@ -140,8 +134,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users")
|
||||
.method("GET")
|
||||
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -161,10 +154,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -304,12 +295,11 @@ let config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -336,8 +326,8 @@ payload = json.dumps({
|
||||
],
|
||||
"is_service_user": false
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -378,9 +368,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -443,8 +433,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -464,9 +454,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
@@ -475,8 +464,8 @@ curl_setopt_array($curl, array(
|
||||
],
|
||||
"is_service_user": false
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -593,12 +582,11 @@ let config = {
|
||||
method: 'put',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users/{userId}',
|
||||
headers: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
},
|
||||
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
@@ -622,8 +610,8 @@ payload = json.dumps({
|
||||
"devs"
|
||||
]
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
@@ -661,9 +649,9 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
{
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
@@ -720,8 +708,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.method("PUT", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
@@ -741,16 +729,15 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"devs"
|
||||
]
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
@@ -827,8 +814,6 @@ echo $response;
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/users/{userId} \
|
||||
-H "Authorization: Token <TOKEN>" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -838,12 +823,9 @@ let config = {
|
||||
method: 'delete',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/users/{userId}',
|
||||
headers: {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
@@ -861,9 +843,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users/{userId}"
|
||||
|
||||
headers = {
|
||||
|
||||
|
||||
headers: {
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
@@ -894,10 +874,8 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
@@ -927,8 +905,6 @@ https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Delete.new(url)
|
||||
|
||||
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
@@ -941,9 +917,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}")
|
||||
.method("DELETE")
|
||||
|
||||
|
||||
.method("DELETE")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
@@ -962,11 +936,8 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
|
||||
|
||||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user