Luna-Accounts (v.0.1.6)

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

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

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"
}

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

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
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

required
object (permissions)

token permissions

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
{
  • "description": "main account token",
  • "expiration_time": "2018-08-11T09:11:41.674Z",
  • "permissions": {
    },
  • "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
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

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

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
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

required
object (permissions)

token permissions

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
{
  • "description": "main account token",
  • "expiration_time": "2018-08-11T09:11:41.674Z",
  • "permissions": {
    },
  • "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
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",
  • "permissions": {
    },
  • "visibility_area": "account",
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515"
}

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

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": {
    }
}

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
}