Skip to content

Latest commit

 

History

History
1779 lines (1344 loc) · 37.2 KB

api.md

File metadata and controls

1779 lines (1344 loc) · 37.2 KB

FastAPI v0.1.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Authentication

  • oAuth2 authentication.

Scope Scope Description

Default

root__get

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/', headers = headers)

print(r.json())

GET /

Root

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

This operation does not require authentication

user

logout_api_v1_logout_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/v1/logout', headers = headers)

print(r.json())

GET /api/v1/logout

Logout

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Not found None

Response Schema

To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

edit_api_v1_user_edit_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/user/edit', headers = headers)

print(r.json())

POST /api/v1/user/edit

Edit

Body parameter

{
  "id": 0,
  "username": "string",
  "email": "string",
  "full_name": "string",
  "role": "string",
  "password": "string"
}

Parameters

Name In Type Required Description
body body UserInDB true none

Example responses

200 Response

{
  "id": 0,
  "username": "string",
  "email": "string",
  "full_name": "string",
  "role": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response User
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

login_api_v1_login_post

Code samples

import requests
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Accept': 'application/json'
}

r = requests.post('/api/v1/login', headers = headers)

print(r.json())

POST /api/v1/login

Login

Body parameter

username: string
password: string

Parameters

Name In Type Required Description
body body Body_login_api_v1_login_post true none

Example responses

200 Response

{
  "access_token": "string",
  "token_type": "string",
  "user": {
    "id": 0,
    "username": "string",
    "email": "string",
    "full_name": "string",
    "role": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response Token
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
This operation does not require authentication

create_user_api_v1_users_create__post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/users/create/', headers = headers)

print(r.json())

POST /api/v1/users/create/

Create User

Body parameter

{
  "id": 0,
  "username": "string",
  "email": "string",
  "full_name": "string",
  "role": "string",
  "password": "string"
}

Parameters

Name In Type Required Description
body body UserInDB true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

server

servers_all_api_v1_server_all_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/v1/server/all', headers = headers)

print(r.json())

GET /api/v1/server/all

Servers All

Example responses

200 Response

[
  {
    "id": 0,
    "address": "string",
    "v6_address": "string",
    "subnet": 0,
    "v6_subnet": 0,
    "interface": "string",
    "listen_port": 0,
    "endpoint": "string",
    "private_key": "string",
    "public_key": "string",
    "is_running": true,
    "configuration": "string",
    "post_up": "string",
    "post_down": "string",
    "dns": "string",
    "peers": []
  }
]

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Not found None

Response Schema

Status Code 200

Response Servers All Api V1 Server All Get

Name Type Required Restrictions Description
Response Servers All Api V1 Server All Get [WGServer] false none none
» WGServer WGServer false none none
»» id integer false none none
»» address string false none none
»» v6_address string false none none
»» subnet integer false none none
»» v6_subnet integer false none none
»» interface string true none none
»» listen_port integer false none none
»» endpoint string false none none
»» private_key string false none none
»» public_key string false none none
»» is_running boolean false none none
»» configuration string false none none
»» post_up string false none none
»» post_down string false none none
»» dns string false none none
»» peers [WGPeer] false none none
»»» WGPeer WGPeer false none none
»»»» id integer false none none
»»»» name string false none none
»»»» address string false none none
»»»» v6_address string false none none
»»»» private_key string false none none
»»»» public_key string false none none
»»»» shared_key string false none none
»»»» server_id string true none none
»»»» dns string false none none
»»»» allowed_ips string false none none
»»»» configuration string false none none
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

add_interface_api_v1_server_add_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/add', headers = headers)

print(r.json())

POST /api/v1/server/add

Add Interface

Body parameter

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Parameters

Name In Type Required Description
body body WGServerAdd true none

Example responses

200 Response

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGServer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

stop_server_api_v1_server_stop_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/stop', headers = headers)

print(r.json())

POST /api/v1/server/stop

Stop Server

Body parameter

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Parameters

Name In Type Required Description
body body WGServer true none

Example responses

200 Response

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGServer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

start_server_api_v1_server_start_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/start', headers = headers)

print(r.json())

POST /api/v1/server/start

Start Server

Body parameter

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Parameters

Name In Type Required Description
body body WGServer true none

Example responses

200 Response

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGServer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

restart_server_api_v1_server_restart_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/restart', headers = headers)

print(r.json())

POST /api/v1/server/restart

Restart Server

Body parameter

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Parameters

Name In Type Required Description
body body WGServer true none

Example responses

200 Response

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGServer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

delete_server_api_v1_server_delete_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/delete', headers = headers)

print(r.json())

POST /api/v1/server/delete

Delete Server

Body parameter

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Parameters

Name In Type Required Description
body body WGServer true none

Example responses

200 Response

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGServer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

stats_server_api_v1_server_stats_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/stats', headers = headers)

print(r.json())

POST /api/v1/server/stats

Stats Server

Body parameter

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Parameters

Name In Type Required Description
body body WGServer true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

edit_server_api_v1_server_edit_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/server/edit', headers = headers)

print(r.json())

POST /api/v1/server/edit

Edit Server

Body parameter

{}

Parameters

Name In Type Required Description
body body object true none

Example responses

200 Response

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGServer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

server_config_api_v1_server_config__server_id__get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/v1/server/config/{server_id}', headers = headers)

print(r.json())

GET /api/v1/server/config/{server_id}

Server Config

Parameters

Name In Type Required Description
server_id path integer true none

Example responses

200 Response

"string"

Responses

Status Meaning Description Schema
200 OK Successful Response string
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

peer

add_peer_api_v1_peer_add_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/peer/add', headers = headers)

print(r.json())

POST /api/v1/peer/add

Add Peer

Body parameter

{
  "server_interface": "string"
}

Parameters

Name In Type Required Description
body body WGPeerAdd true none

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "address": "string",
  "v6_address": "string",
  "private_key": "string",
  "public_key": "string",
  "shared_key": "string",
  "server_id": "string",
  "dns": "string",
  "allowed_ips": "string",
  "configuration": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGPeer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

delete_peer_api_v1_peer_delete_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/peer/delete', headers = headers)

print(r.json())

POST /api/v1/peer/delete

Delete Peer

Body parameter

{
  "id": 0,
  "name": "string",
  "address": "string",
  "v6_address": "string",
  "private_key": "string",
  "public_key": "string",
  "shared_key": "string",
  "server_id": "string",
  "dns": "string",
  "allowed_ips": "string",
  "configuration": "string"
}

Parameters

Name In Type Required Description
body body WGPeer true none

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "address": "string",
  "v6_address": "string",
  "private_key": "string",
  "public_key": "string",
  "shared_key": "string",
  "server_id": "string",
  "dns": "string",
  "allowed_ips": "string",
  "configuration": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response WGPeer
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

edit_peer_api_v1_peer_edit_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/v1/peer/edit', headers = headers)

print(r.json())

POST /api/v1/peer/edit

Edit Peer

Body parameter

{
  "id": 0,
  "name": "string",
  "address": "string",
  "v6_address": "string",
  "private_key": "string",
  "public_key": "string",
  "shared_key": "string",
  "server_id": "string",
  "dns": "string",
  "allowed_ips": "string",
  "configuration": "string"
}

Parameters

Name In Type Required Description
body body WGPeer true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Not found None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

wg

generate_psk_api_v1_wg_generate_psk_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/v1/wg/generate_psk', headers = headers)

print(r.json())

GET /api/v1/wg/generate_psk

Generate Psk

Example responses

200 Response

{
  "psk": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response PSK
404 Not Found Not found None
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

generate_key_pair_api_v1_wg_generate_keypair_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/v1/wg/generate_keypair', headers = headers)

print(r.json())

GET /api/v1/wg/generate_keypair

Generate Key Pair

Example responses

200 Response

{
  "public_key": "string",
  "private_key": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response KeyPair
404 Not Found Not found None
To perform this operation, you must be authenticated by means of one of the following methods: OAuth2PasswordBearer

Schemas

Body_login_api_v1_login_post

{
  "username": "string",
  "password": "string"
}

Body_login_api_v1_login_post

Properties

Name Type Required Restrictions Description
username string true none none
password string true none none

HTTPValidationError

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

HTTPValidationError

Properties

Name Type Required Restrictions Description
detail [ValidationError] false none none

KeyPair

{
  "public_key": "string",
  "private_key": "string"
}

KeyPair

Properties

Name Type Required Restrictions Description
public_key string true none none
private_key string true none none

PSK

{
  "psk": "string"
}

PSK

Properties

Name Type Required Restrictions Description
psk string true none none

Token

{
  "access_token": "string",
  "token_type": "string",
  "user": {
    "id": 0,
    "username": "string",
    "email": "string",
    "full_name": "string",
    "role": "string"
  }
}

Token

Properties

Name Type Required Restrictions Description
access_token string true none none
token_type string true none none
user User true none none

User

{
  "id": 0,
  "username": "string",
  "email": "string",
  "full_name": "string",
  "role": "string"
}

User

Properties

Name Type Required Restrictions Description
id integer false none none
username string true none none
email string false none none
full_name string false none none
role string false none none

UserInDB

{
  "id": 0,
  "username": "string",
  "email": "string",
  "full_name": "string",
  "role": "string",
  "password": "string"
}

UserInDB

Properties

Name Type Required Restrictions Description
id integer false none none
username string true none none
email string false none none
full_name string false none none
role string false none none
password string true none none

ValidationError

{
  "loc": [
    "string"
  ],
  "msg": "string",
  "type": "string"
}

ValidationError

Properties

Name Type Required Restrictions Description
loc [string] true none none
msg string true none none
type string true none none

WGPeer

{
  "id": 0,
  "name": "string",
  "address": "string",
  "v6_address": "string",
  "private_key": "string",
  "public_key": "string",
  "shared_key": "string",
  "server_id": "string",
  "dns": "string",
  "allowed_ips": "string",
  "configuration": "string"
}

WGPeer

Properties

Name Type Required Restrictions Description
id integer false none none
name string false none none
address string false none none
v6_address string false none none
private_key string false none none
public_key string false none none
shared_key string false none none
server_id string true none none
dns string false none none
allowed_ips string false none none
configuration string false none none

WGPeerAdd

{
  "server_interface": "string"
}

WGPeerAdd

Properties

Name Type Required Restrictions Description
server_interface string true none none

WGServer

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

WGServer

Properties

Name Type Required Restrictions Description
id integer false none none
address string false none none
v6_address string false none none
subnet integer false none none
v6_subnet integer false none none
interface string true none none
listen_port integer false none none
endpoint string false none none
private_key string false none none
public_key string false none none
is_running boolean false none none
configuration string false none none
post_up string false none none
post_down string false none none
dns string false none none
peers [WGPeer] false none none

WGServerAdd

{
  "id": 0,
  "address": "string",
  "v6_address": "string",
  "subnet": 0,
  "v6_subnet": 0,
  "interface": "string",
  "listen_port": 0,
  "endpoint": "string",
  "private_key": "string",
  "public_key": "string",
  "is_running": true,
  "configuration": "string",
  "post_up": "string",
  "post_down": "string",
  "dns": "string",
  "peers": []
}

WGServerAdd

Properties

Name Type Required Restrictions Description
id integer false none none
address string true none none
v6_address string false none none
subnet integer false none none
v6_subnet integer false none none
interface string true none none
listen_port integer true none none
endpoint string false none none
private_key string false none none
public_key string false none none
is_running boolean false none none
configuration string false none none
post_up string false none none
post_down string false none none
dns string false none none
peers [WGPeer] false none none