Luna-Sender API (v.2.12.7)

Download OpenAPI specification:Download

VisionLabs Luna Sender API.

OpenAPI specification is the only valid document providing up-to-date information about the service API.

The specification can be used:

  • By documentation generation tools to visualize the API.
  • By code generation tools.

All the documents and code generated using this specification can include inaccuracies and should be carefully checked.

OpenAPI specification can be received using the "/docs/spec" resource. The "Accept" header should be set to "application/x-yaml".

version

get version

Get versions of services.

header Parameters
Luna-Request-Id
string^[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 is "{timestamp},{uuid}". It will be returned with response.

Responses

Response samples

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

ws

ws handshake

Ws handshake.

Attention!

Subscription to events occurs via WebSocket. Messages sent by ws you can view in callback section. Connection supports autoping.

query Parameters
sources
string
Example: sources=cam1,cam2

Comma-separated list of sources. Each event from result will contain one of the given sources.

stream_ids
string <list of uuid.>
Example: stream_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38

List of comma-separated stream IDs.

matching_candidates_labels
string
Example: matching_candidates_labels=matching_label

Matching candidates labels. Each event from result will contain one or more given labels.

object_similarity__gte
number
Example: object_similarity__gte=0.5

Similar object similarity lower included bound (boundary for top matching candidate).

object_similarity__lt
number
Example: object_similarity__lt=0.5

Top similar object similarity upper excluded bound (boundary for top matching candidate).

age__lt
integer
Example: age__lt=50

Age upper excluded bound.

age__gte
integer
Example: age__gte=50

Age lower included bound.

gender
integer
Enum: 0 1
Example: gender=1

Gender. 1 - male, 0 - female.

ethnic_groups
string <list of integer (1, 2, 3, 4)>
Example: ethnic_groups=1,2

Comma-separated list of dominant ethnic group. Each event from result will contain one of the given ethnic groups.

ethnicity value
AfricanAmerican 1
Indian 2
Asian 3
Caucasian 4
liveness
string <list of integer (1, 2, 3)>
Example: liveness=0,2

Comma-separated list of dominant liveness. Each event from result will contain one of the given liveness state.

liveness value
spoof 0
real 1
unknown 2
deepfake
string <list of integer (0, 1)>
Example: deepfake=0,1

Comma-separated list of dominant deepfake. Each event from result will contain one of the given deepfake state.

deepfake value
real 1
fake 0
masks
string <list of integer (1, 2, 3)>
Example: masks=1,2,3

Comma-separated list of predominant masks. Each event from result will contain one of the given mask state.

mask value
missing 1
medical_mask 2
occluded 3
emotions
string <list of integer (1, 2, 3, 4, 5, 6, 7)>
Example: emotions=1,2,3

Comma-separated list of predominant emotions. Each event from result will contain one of the given emotions.

emotions value
anger 1
disgust 2
fear 3
happiness 4
neutral 5
sadness 6
surprise 7
tags
Array of strings (tag) >= 0 items [ items <= 36 characters ]
Example: tags=tag_1,tag_2

A comma-separated list of tags. Each event from result will contain all of the given tags. Each tag can be at most 36 characters.

user_data
string
Example: user_data=some%20special%20user%20info

User data filter. Each event from result will contain user data that matches the filter value. For example, events with user data of abcd and cdef will match the filter value cd.

object
Example: geo_position=origin_longitude,36.616,origin_latitude,55.752

Geo position filter, i.e. geo bounding box specified by coordinates of its center (origin) and some delta. Each event from result will be covered by bbox specified.

cities
string
Example: cities=moscow,New-York

Comma-separated list of cities. Each event from result will contain one of the given cities in location.

areas
string
Example: areas=CAO,central park

Comma-separated list of areas. Each event from result will contain one of the given areas in location.

districts
string
Example: districts=mitino,central park

Comma-separated list of districts. Each event from result will contain one of the given districts in location.

streets
string
Example: streets=arbat,schepkina

Comma-separated list of streets. Each event from result will contain one of the given streets in location.

house_numbers
string
Example: house_numbers=1,1/2str3

Comma-separated list of house numbers. Each event from result will contain one of the given house numbers. in location.

handler_ids
string <list of uuid.>
Example: handler_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38

List of comma-separated handler IDs.

apparent_gender
integer
Enum: 0 1 2
Example: apparent_gender=1

Comma-separated list of apparent gender: 0 - female, 1 - male, 2 - undefined. Each event from result will contain one of the given states.

apparent_age__gte
integer [ 0 .. 100 ]
Example: apparent_age__gte=50

Apparent age lower included bound.

apparent_age__lt
integer [ 0 .. 100 ]
Example: apparent_age__lt=50

Apparent age upper excluded bound.

headwear_states
integer
Enum: 0 1 2
Example: headwear_states=1

Comma-separated list of headwear states: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.

sleeve_lengths
string
Enum: "short" "long" "undefined"
Example: sleeve_lengths=short

Comma-separated list of sleeve length states. Each event from result will contain one of the given states.

upper_clothing_colors
string (expanded_palette)
Enum: "black" "blue" "green" "gray" "orange" "purple" "red" "white" "yellow" "pink" "brown" "beige" "khaki" "multicolored" "undefined"
Example: upper_clothing_colors=black,white

Comma-separated list of upper clothing colors. Each event from result will contain at least one of the given clothing colors.

lower_garment_colors
string (expanded_palette)
Enum: "black" "blue" "green" "gray" "orange" "purple" "red" "white" "yellow" "pink" "brown" "beige" "khaki" "multicolored" "undefined"
Example: lower_garment_colors=black,white

Comma-separated list of lower garment colors. Each event from result will contain at least one of the given clothing colors.

lower_garment_types
string
Enum: "trousers" "shorts" "skirt" "undefined"
Example: lower_garment_types=trousers,skirt

Comma-separated list of lower garment types 0 - trousers, 1 - shorts, 2 - skirt, 3 - undefined. Each event from result will contain at least one of the given types.

shoes_colors
string (short_palette)
Enum: "black" "other" "white" "undefined"
Example: shoes_colors=black,white

Comma-separated list of shoes colors. Each event from result will contain at least one of the given colors.

headwear_colors
string (short_palette)
Enum: "black" "other" "white" "undefined"
Example: headwear_colors=black,white

Comma-separated list of headwear colors. Each event from result will contain at least one of the given colors.

backpack_states
integer
Enum: 0 1 2
Example: backpack_states=1

Comma-separated list of backpack states: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.

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

Account ID. Specify an account ID to be noticed about events in the account.

Luna-Request-Id
string^[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 is "{timestamp},{uuid}". It will be returned with response.

Responses

Request samples

from luna3.sender.wsclient import LunaWSClient

senderAPI = LunaWSClient(origin="http://127.0.0.1:5080", api=2, accountId="8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a")
# Note filtering by gender!
with senderAPI.connect(gender=1) as ws:
    for _ in range(3):
        resp = ws.recv()
        print(resp)

Response samples

Content type
application/json
{
  • "event": {
    },
  • "handler_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "event-create-time": "2019-08-24T14:15:22Z",
  • "event-end-time": "2019-08-24T14:15:22Z",
  • "Luna-Request-id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a"
}

ws handshake for general events

Ws handshake.

Attention!

Subscription to events occurs via WebSocket. Messages sent by ws you can view in callback section. Connection supports autoping.

query Parameters
event_type
required
string
Example: event_type=some_event_type

General event type to subscribe.

account_id
string
Example: account_id=8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

General event account to subscribe.

* (event.path.to.field__operator:type)
string
Example: event.field_1__gt:numeric=36.6&event.field_2.field_3__in=value,none&event.field_4:integer=5

User-defined general event filters.

Parameter name pattern: event.<path.to.field>__<operator>:<type>

Path to field is an event json field path. To navigate through nested objects the dot (.) is used.

Field comparison operator is optional one of eq (default), neq, like, nlike, in, nin, gt, gte, lt, lte.

Field data type is optional one of string (default), integer, numeric.

Allowed usage of filters is:

operator type
none string integer numeric
eq + + + +
neq + + + +
like - + - -
nlike - + - -
in + + + +
nin + + + +
gt - + + +
gte - + + +
lt - + + +
lte - + + +
header Parameters
Luna-Request-Id
string^[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 is "{timestamp},{uuid}". It will be returned with response.

Responses

Request samples

from luna3.sender.wsclient import LunaWSClient

senderAPI = LunaWSClient(origin="http://127.0.0.1:5080", api=2)
with senderAPI.generalConnect(eventType="some_event_type") as ws:
    for _ in range(3):
        resp = ws.recv()
        print(resp)

Response samples

Content type
application/json
{
  • "event": { },
  • "event_type": "string",
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "event-create-time": "2019-08-24T14:15:22Z",
  • "event-end-time": "2019-08-24T14:15:22Z"
}

events

publish events

Publish events generated by the user.

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

Account ID. Specify an account ID to be noticed about events in the account.

Luna-Request-Id
string^[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 is "{timestamp},{uuid}". It will be returned with response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
events
required
Array of objects non-empty

User generated events to be published.

handler_id
required
string

Event handler ID.

event_create_time
required
string

Event creation time.

event_end_time
required
string

Event end time.

Responses

Request samples

Content type
application/json
{
  • "events": [
    ],
  • "handler_id": "string",
  • "event_create_time": "string",
  • "event_end_time": "string"
}

Response samples

Content type
application/json
Example
{}

publish general events

Publish events generated by the user.

header Parameters
Luna-Request-Id
string^[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 is "{timestamp},{uuid}". It will be returned with response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
events
required
Array of objects non-empty

User generated events to be published.

event_type
required
string

General event type.

account_id
string

Event account ID.

event_create_time
string

Event creation time.

event_end_time
string

Event end time.

Responses

Request samples

Content type
application/json
{
  • "events": [
    ],
  • "event_type": "string",
  • "account_id": "string",
  • "event_create_time": "string",
  • "event_end_time": "string"
}

Response samples

Content type
application/json
{}

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^[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 is "{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^[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 is "{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^[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 is "{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^[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 is "{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^[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 is "{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.

header Parameters
Luna-Request-Id
string^[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 is "{timestamp},{uuid}". It will be returned with response.

Responses

Response samples

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