Authentication

July 19, 2020 · View on GitHub

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.

ScopeScope 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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline

Response Schema

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline
404Not FoundNot foundNone

Response Schema

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

NameInTypeRequiredDescription
bodybodyUserInDBtruenone

Example responses

200 Response

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

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseUser
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyBody_login_api_v1_login_posttruenone

Example responses

200 Response

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

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseToken
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyUserInDBtruenone

Example responses

200 Response

null

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

Response Schema

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline
404Not FoundNot foundNone

Response Schema

Status Code 200

Response Servers All Api V1 Server All Get

NameTypeRequiredRestrictionsDescription
Response Servers All Api V1 Server All Get[WGServer]falsenonenone
» WGServerWGServerfalsenonenone
»» idintegerfalsenonenone
»» addressstringfalsenonenone
»» v6_addressstringfalsenonenone
»» subnetintegerfalsenonenone
»» v6_subnetintegerfalsenonenone
»» interfacestringtruenonenone
»» listen_portintegerfalsenonenone
»» endpointstringfalsenonenone
»» private_keystringfalsenonenone
»» public_keystringfalsenonenone
»» is_runningbooleanfalsenonenone
»» configurationstringfalsenonenone
»» post_upstringfalsenonenone
»» post_downstringfalsenonenone
»» dnsstringfalsenonenone
»» peers[WGPeer]falsenonenone
»»» WGPeerWGPeerfalsenonenone
»»»» idintegerfalsenonenone
»»»» namestringfalsenonenone
»»»» addressstringfalsenonenone
»»»» v6_addressstringfalsenonenone
»»»» private_keystringfalsenonenone
»»»» public_keystringfalsenonenone
»»»» shared_keystringfalsenonenone
»»»» server_idstringtruenonenone
»»»» dnsstringfalsenonenone
»»»» allowed_ipsstringfalsenonenone
»»»» configurationstringfalsenonenone

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

NameInTypeRequiredDescription
bodybodyWGServerAddtruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGServer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGServertruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGServer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGServertruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGServer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGServertruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGServer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGServertruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGServer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGServertruenone

Example responses

200 Response

null

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

Response Schema

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

NameInTypeRequiredDescription
bodybodyobjecttruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGServer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
server_idpathintegertruenone

Example responses

200 Response

"string"

Responses

StatusMeaningDescriptionSchema
200OKSuccessful Responsestring
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGPeerAddtruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGPeer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGPeertruenone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseWGPeer
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

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

NameInTypeRequiredDescription
bodybodyWGPeertruenone

Example responses

200 Response

null

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline
404Not FoundNot foundNone
422Unprocessable EntityValidation ErrorHTTPValidationError

Response Schema

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponsePSK
404Not FoundNot foundNone

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

StatusMeaningDescriptionSchema
200OKSuccessful ResponseKeyPair
404Not FoundNot foundNone

Schemas

Body_login_api_v1_login_post

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

Body_login_api_v1_login_post

Properties

NameTypeRequiredRestrictionsDescription
usernamestringtruenonenone
passwordstringtruenonenone

HTTPValidationError

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

HTTPValidationError

Properties

NameTypeRequiredRestrictionsDescription
detail[ValidationError]falsenonenone

KeyPair

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

KeyPair

Properties

NameTypeRequiredRestrictionsDescription
public_keystringtruenonenone
private_keystringtruenonenone

PSK

{
  "psk": "string"
}

PSK

Properties

NameTypeRequiredRestrictionsDescription
pskstringtruenonenone

Token

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

Token

Properties

NameTypeRequiredRestrictionsDescription
access_tokenstringtruenonenone
token_typestringtruenonenone
userUsertruenonenone

User

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

User

Properties

NameTypeRequiredRestrictionsDescription
idintegerfalsenonenone
usernamestringtruenonenone
emailstringfalsenonenone
full_namestringfalsenonenone
rolestringfalsenonenone

UserInDB

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

UserInDB

Properties

NameTypeRequiredRestrictionsDescription
idintegerfalsenonenone
usernamestringtruenonenone
emailstringfalsenonenone
full_namestringfalsenonenone
rolestringfalsenonenone
passwordstringtruenonenone

ValidationError

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

ValidationError

Properties

NameTypeRequiredRestrictionsDescription
loc[string]truenonenone
msgstringtruenonenone
typestringtruenonenone

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

NameTypeRequiredRestrictionsDescription
idintegerfalsenonenone
namestringfalsenonenone
addressstringfalsenonenone
v6_addressstringfalsenonenone
private_keystringfalsenonenone
public_keystringfalsenonenone
shared_keystringfalsenonenone
server_idstringtruenonenone
dnsstringfalsenonenone
allowed_ipsstringfalsenonenone
configurationstringfalsenonenone

WGPeerAdd

{
  "server_interface": "string"
}

WGPeerAdd

Properties

NameTypeRequiredRestrictionsDescription
server_interfacestringtruenonenone

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

NameTypeRequiredRestrictionsDescription
idintegerfalsenonenone
addressstringfalsenonenone
v6_addressstringfalsenonenone
subnetintegerfalsenonenone
v6_subnetintegerfalsenonenone
interfacestringtruenonenone
listen_portintegerfalsenonenone
endpointstringfalsenonenone
private_keystringfalsenonenone
public_keystringfalsenonenone
is_runningbooleanfalsenonenone
configurationstringfalsenonenone
post_upstringfalsenonenone
post_downstringfalsenonenone
dnsstringfalsenonenone
peers[WGPeer]falsenonenone

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

NameTypeRequiredRestrictionsDescription
idintegerfalsenonenone
addressstringtruenonenone
v6_addressstringfalsenonenone
subnetintegerfalsenonenone
v6_subnetintegerfalsenonenone
interfacestringtruenonenone
listen_portintegertruenonenone
endpointstringfalsenonenone
private_keystringfalsenonenone
public_keystringfalsenonenone
is_runningbooleanfalsenonenone
configurationstringfalsenonenone
post_upstringfalsenonenone
post_downstringfalsenonenone
dnsstringfalsenonenone
peers[WGPeer]falsenonenone