mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 16:36:35 +00:00
Update API pages with v0.26.3
This commit is contained in:
@@ -11,7 +11,7 @@ export const title = 'Users'
|
||||
#### Query Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="service_user" type="boolean" required={false}>
|
||||
<Property name="service_user" type="" required={false}>
|
||||
Filters users and returns either regular users or service users
|
||||
</Property>
|
||||
</Properties>
|
||||
@@ -168,42 +168,18 @@ echo $response;
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
[
|
||||
{
|
||||
"id": "google-oauth2|277474792786460067937",
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"status": "active",
|
||||
"last_login": "2023-05-05T09:00:35.477782Z",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_current": true,
|
||||
"is_service_user": false,
|
||||
"is_blocked": false,
|
||||
"issued": "api"
|
||||
{
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
[
|
||||
{
|
||||
"id": "string",
|
||||
"email": "string",
|
||||
"name": "string",
|
||||
"role": "string",
|
||||
"status": "string",
|
||||
"last_login": "string",
|
||||
"auto_groups": [
|
||||
"string"
|
||||
],
|
||||
"is_current": "boolean",
|
||||
"is_service_user": "boolean",
|
||||
"is_blocked": "boolean",
|
||||
"issued": "string"
|
||||
{
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -219,38 +195,7 @@ echo $response;
|
||||
<Row>
|
||||
<Col>
|
||||
Creates a new service user or sends an invite to a regular user
|
||||
|
||||
#### Request-Body Parameters
|
||||
|
||||
<Properties><Property name="email" type="string" required={false}>
|
||||
|
||||
User's Email to send invite to
|
||||
|
||||
</Property>
|
||||
<Property name="name" type="string" required={false}>
|
||||
|
||||
User's full name
|
||||
|
||||
</Property>
|
||||
<Property name="role" type="string" required={true}>
|
||||
|
||||
User's NetBird account role
|
||||
|
||||
</Property>
|
||||
<Property name="auto_groups" type="string[]" required={true}>
|
||||
|
||||
Group IDs to auto-assign to peers registered by this user
|
||||
|
||||
</Property>
|
||||
<Property name="is_service_user" type="boolean" required={true}>
|
||||
|
||||
Is true if this user is a service user
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
||||
</Col>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="POST" label="/api/users">
|
||||
@@ -260,26 +205,14 @@ curl -X POST https://api.netbird.io/api/users \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Token <TOKEN>' \
|
||||
--data-raw '{
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
}'
|
||||
```
|
||||
|
||||
```js
|
||||
const axios = require('axios');
|
||||
let data = JSON.stringify({
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
});
|
||||
let config = {
|
||||
method: 'post',
|
||||
@@ -308,13 +241,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users"
|
||||
payload = json.dumps({
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
})
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -343,13 +270,7 @@ func main() {
|
||||
method := "POST"
|
||||
|
||||
payload := strings.NewReader(`{
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
}`)
|
||||
client := &http.Client {
|
||||
}
|
||||
@@ -396,13 +317,7 @@ request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
request.body = JSON.dump({
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
})
|
||||
response = https.request(request)
|
||||
puts response.read_body
|
||||
@@ -413,13 +328,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, '{
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users")
|
||||
@@ -446,13 +355,7 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_service_user": false
|
||||
"$ref": "#/components/schemas/UserCreateRequest"
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
@@ -473,36 +376,12 @@ echo $response;
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"id": "google-oauth2|277474792786460067937",
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"status": "active",
|
||||
"last_login": "2023-05-05T09:00:35.477782Z",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_current": true,
|
||||
"is_service_user": false,
|
||||
"is_blocked": false,
|
||||
"issued": "api"
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
{
|
||||
"id": "string",
|
||||
"email": "string",
|
||||
"name": "string",
|
||||
"role": "string",
|
||||
"status": "string",
|
||||
"last_login": "string",
|
||||
"auto_groups": [
|
||||
"string"
|
||||
],
|
||||
"is_current": "boolean",
|
||||
"is_service_user": "boolean",
|
||||
"is_blocked": "boolean",
|
||||
"issued": "string"
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
@@ -527,28 +406,7 @@ echo $response;
|
||||
The unique identifier of a user
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
#### Request-Body Parameters
|
||||
|
||||
<Properties><Property name="role" type="string" required={true}>
|
||||
|
||||
User's NetBird account role
|
||||
|
||||
</Property>
|
||||
<Property name="auto_groups" type="string[]" required={true}>
|
||||
|
||||
Group IDs to auto-assign to peers registered by this user
|
||||
|
||||
</Property>
|
||||
<Property name="is_blocked" type="boolean" required={true}>
|
||||
|
||||
If set to true then user is blocked and can't use the system
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
||||
</Col>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="PUT" label="/api/users/{userId}">
|
||||
@@ -558,22 +416,14 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Token <TOKEN>' \
|
||||
--data-raw '{
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
}'
|
||||
```
|
||||
|
||||
```js
|
||||
const axios = require('axios');
|
||||
let data = JSON.stringify({
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
});
|
||||
let config = {
|
||||
method: 'put',
|
||||
@@ -602,11 +452,7 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/users/{userId}"
|
||||
payload = json.dumps({
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
})
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -635,11 +481,7 @@ func main() {
|
||||
method := "PUT"
|
||||
|
||||
payload := strings.NewReader(`{
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
}`)
|
||||
client := &http.Client {
|
||||
}
|
||||
@@ -686,11 +528,7 @@ request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
request.body = JSON.dump({
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
})
|
||||
response = https.request(request)
|
||||
puts response.read_body
|
||||
@@ -701,11 +539,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, '{
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
}');
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/users/{userId}")
|
||||
@@ -732,11 +566,7 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"role": "admin",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_blocked": false
|
||||
"$ref": "#/components/schemas/UserRequest"
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
@@ -757,36 +587,12 @@ echo $response;
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"id": "google-oauth2|277474792786460067937",
|
||||
"email": "demo@netbird.io",
|
||||
"name": "Tom Schulz",
|
||||
"role": "admin",
|
||||
"status": "active",
|
||||
"last_login": "2023-05-05T09:00:35.477782Z",
|
||||
"auto_groups": [
|
||||
"ch8i4ug6lnn4g9hqv7m0"
|
||||
],
|
||||
"is_current": true,
|
||||
"is_service_user": false,
|
||||
"is_blocked": false,
|
||||
"issued": "api"
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
{
|
||||
"id": "string",
|
||||
"email": "string",
|
||||
"name": "string",
|
||||
"role": "string",
|
||||
"status": "string",
|
||||
"last_login": "string",
|
||||
"auto_groups": [
|
||||
"string"
|
||||
],
|
||||
"is_current": "boolean",
|
||||
"is_service_user": "boolean",
|
||||
"is_blocked": "boolean",
|
||||
"issued": "string"
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Reference in New Issue
Block a user