Luna-Accounts (v.0.3.42)

Download OpenAPI specification:Download

VisionLabs Luna Accounts API

version

get version

get version of service

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "Version": {
    }
}

accounts

create account

create a new account

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Luna-Account-Id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id for new account creation

Request Body schema: application/json
login
required
string (login) [ 3 .. 128 ] characters ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$

account username

password
required
string (password) [ 3 .. 128 ] characters

account password

account_type
required
string (account_type)
Enum: "admin" "advanced_user" "user"

account type

description
string (account_description) <= 128 characters
Default: ""

account description

Responses

Request samples

Content type
application/json
{
  • "login": "mylogin@visionlabs.ru",
  • "password": "string",
  • "account_type": "admin",
  • "description": "main admin account"
}

Response samples

Content type
application/json
{
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "url": "/1/accounts/557d54ec-29ad-4f3c-93b4-c9092ef12515"
}

get accounts

get accounts

query Parameters
page
integer >= 1
Default: 1

a page number.

page_size
integer [ 1 .. 100 ]
Default: 10

the number of items on page.

login
string (login) [ 3 .. 128 ] characters ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$
Example: login=user@visionlabs.ru

account login

account_type
string (account_type)
Enum: "admin" "advanced_user" "user"
Example: account_type=user

account type

create_time__lt
string <date-time>
Example: create_time__lt=2018-08-11T09:11:41.674Z

upper bound for object create_time.

create_time__gte
string <date-time>
Example: create_time__gte=2018-08-11T09:11:41.674Z

lower included bound for object create_time.

targets
string
Default: ["account_id","login","account_type","description","create_time","last_update_time"]
Enum: "account_id" "login" "account_type" "description" "create_time" "last_update_time"
Example: targets=login

Comma-separated list of account target fields. Available targets: account_id, login, account_type, description, create_time, last_update_time

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "accounts": [
    ],
  • "total_count": 50
}

get account

get account by id

path Parameters
account_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

query Parameters
targets
string
Default: ["account_id","login","account_type","description","create_time","last_update_time"]
Enum: "account_id" "login" "account_type" "description" "create_time" "last_update_time"
Example: targets=login

Comma-separated list of account target fields. Available targets: account_id, login, account_type, description, create_time, last_update_time

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "login": "mylogin@visionlabs.ru",
  • "account_type": "admin",
  • "description": "main admin account",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z"
}

patch account

patch account by id. At least one field must be specified

path Parameters
account_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Request Body schema: application/json
non-empty
login
string (login) [ 3 .. 128 ] characters ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$

account username

password
string (password) [ 3 .. 128 ] characters

account password

account_type
string (account_type)
Enum: "admin" "advanced_user" "user"

account type

description
string (account_description) <= 128 characters
Default: ""

account description

Responses

Request samples

Content type
application/json
{
  • "login": "mylogin@visionlabs.ru",
  • "password": "string",
  • "account_type": "admin",
  • "description": "main admin account"
}

Response samples

Content type
application/json
Example
{
  • "error_code": 12022,
  • "desc": "Bad/incomplete input data",
  • "detail": "Failed to validate input json. Path: 'extra_field', message: 'extra fields not permitted'"
}

delete account

delete account by id

path Parameters
account_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{}

get accounts count

get total accounts count

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "count": 50
}

tokens

create token

create a new token

query Parameters
grant_all_permissions
integer
Default: 0
Enum: 0 1

Grant all permissions to token. 1 - give, 0 - do not give. If value is 1 then permissions field is not required.

Grant only standart permissions.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Luna-Account-Id
required
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

Request Body schema: application/json
Any of
required
object

token permissions

* it is possible to use custom fields for permissions besides those given here

custom fields must have 3-16 characters (lowercase letters, _) with possible permissions: "creation", "view", "modification", "deletion"

"creation" — allows POST requests

"view" — allows GET requests

"modification" — allows PUT and PATCH requests

"deletion" — allows DELETE requests

description
string (token_description) <= 128 characters
Default: ""

token description

expiration_time
required
string or null <date-time>

expiration time if format RFC 3339. null for eternal token

visibility_area
string (visibility_area)
Default: "all"
Enum: "account" "all"

specifies data visible for the token.

account - only data related to token's account can be received using GET requests.

all - data of all existing accounts can be received using GET requests. This option does not applicable for user account.

Responses

Request samples

Content type
application/json
Example
{
  • "permissions": {
    },
  • "description": "main account token",
  • "expiration_time": "2018-08-11T09:11:41.674Z",
  • "visibility_area": "account"
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "url": "/1/tokens/557d54ec-29ad-4f3c-93b4-c9092ef12515"
}

get tokens

get tokens

query Parameters
permissions_targets
string
Default: "standard"
Enum: "standard" "custom" "all"
Example: permissions_targets=standard

types of permissions to return:

"standard" — only standard for platform

"custom" — only custom

"all" — standard and custom

page
integer >= 1
Default: 1

a page number.

page_size
integer [ 1 .. 100 ]
Default: 10

the number of items on page.

account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

create_time__lt
string <date-time>
Example: create_time__lt=2018-08-11T09:11:41.674Z

upper bound for object create_time.

create_time__gte
string <date-time>
Example: create_time__gte=2018-08-11T09:11:41.674Z

lower included bound for object create_time.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "tokens": [
    ]
}

replace token

Update token. You cannot update a part of the token, so you should specify all the fields for your token.

path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

token id

query Parameters
grant_all_permissions
integer
Default: 0
Enum: 0 1

Grant all permissions to token. 1 - give, 0 - do not give. If value is 1 then permissions field is not required.

Grant only standart permissions.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Luna-Account-Id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

Request Body schema: application/json
Any of
required
object

token permissions

* it is possible to use custom fields for permissions besides those given here

custom fields must have 3-16 characters (lowercase letters, _) with possible permissions: "creation", "view", "modification", "deletion"

"creation" — allows POST requests

"view" — allows GET requests

"modification" — allows PUT and PATCH requests

"deletion" — allows DELETE requests

description
string (token_description) <= 128 characters
Default: ""

token description

expiration_time
required
string or null <date-time>

expiration time if format RFC 3339. null for eternal token

visibility_area
string (visibility_area)
Default: "all"
Enum: "account" "all"

specifies data visible for the token.

account - only data related to token's account can be received using GET requests.

all - data of all existing accounts can be received using GET requests. This option does not applicable for user account.

Responses

Request samples

Content type
application/json
Example
{
  • "permissions": {
    },
  • "description": "main account token",
  • "expiration_time": "2018-08-11T09:11:41.674Z",
  • "visibility_area": "account"
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "url": "/1/tokens/557d54ec-29ad-4f3c-93b4-c9092ef12515"
}

get token

get token by id

path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

token id

query Parameters
permissions_targets
string
Default: "standard"
Enum: "standard" "custom" "all"
Example: permissions_targets=standard

types of permissions to return:

"standard" — only standard for platform

"custom" — only custom

"all" — standard and custom

account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "description": "main account token",
  • "expiration_time": "2018-08-11T09:11:41.674Z",
  • "visibility_area": "account",
  • "permissions": {
    },
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z"
}

delete token

delete token by id

path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

token id

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

account id

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{}

verifier

verify credentials

Verify account or login with password or token

In the case of success account id verification, account_type will be returned

In the case of success login/password verification, account_id and account_type will be returned

In the case of success token verification, account_type and token permissions will be returned

In the case of failure verification, error will be returned

query Parameters
permissions_targets
string
Default: "standard"
Enum: "standard" "custom" "all"
Example: permissions_targets=standard

types of permissions to return:

"standard" — only standard for platform

"custom" — only custom

"all" — standard and custom

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Request Body schema: application/json
One of
login
required
string (login) [ 3 .. 128 ] characters ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$

account username

password
required
string (password) [ 3 .. 128 ] characters

account password

Responses

Request samples

Content type
application/json
Example
{
  • "login": "mylogin@visionlabs.ru",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "permissions": {
    },
  • "account_type": "admin",
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515"
}

documents

get openapi documentation

Get service OpenApi documentation. If Accept request header is of type application/x-yaml, returns documentation in yaml format or returns html documentation, if Accept-Type is text/html

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Accept
required
string (accept_docs_handler)
Enum: "application/x-yaml" "text/html"

acceptable type of receiving data

Responses

Response samples

Content type
application/json
{}

get development manual

Get sphinx documentation - Development Manual. After the request you will be redirected to the page /docs/dev/index.html

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{}

config

get service configuration

Get service configuration. Passwords and tokens will be hidden in the response.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Accept
string
Enum: "application/json" "text/plain"

acceptable type of receiving data

Responses

Response samples

Content type
{
  • "INFLUX_MONITORING": {
    }
}

plugins

get list of plugins

Get list of service plugins

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "plugins": [
    ]
}

metrics

get service requests statistics

Get statistics of success and failed requests to the service in prometheus format.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
text/plain
# HELP request_count_total Counter of requests
# TYPE request_count_total counter
request_count_total{path="GET:/healthcheck",status_code="200"} 1.0

health

get health

get health of service

query Parameters
include_luna_services
integer
Default: 0
Enum: 0 1

whether to perform healthchecks for dependent luna services.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "execution_time": 0.123
}