Перейти к основному содержимому

Устройства API 1.7.0

Методы API для работы с разделом «Устройства».

Базовый путь: https://{IP_контроллера}/api/v1. Версия описания API: 1.7.0.

Примеры используют placeholder-значения для паролей, token, UUID, адресов и секретов. Перед выполнением запроса замените их на значения вашего контроллера.

Методы раздела

МетодПуть
GET/device_search
POST/device_search
POST/device_search/save
GET/device_search/status
GET/devices
POST/devices/action
GET/devices/by_controller/{controller}
GET/devices/controllers_list
GET/devices/count
GET/devices/find
GET/devices/have_errors
GET/devices/have_notifications
GET/devices/{uuid}
PUT/devices/{uuid}
DELETE/devices/{uuid}

Раздел: Устройства.

Возвращает последние или текущие результаты поиска устройств.

Параметры и ответы по OpenAPI
{
"description": "Get last or current search results",
"responses": {
"200": {
"description": "Successfully returned device search results",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"address",
"vendor",
"subdevices"
],
"properties": {
"address": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"address",
"type"
],
"properties": {
"address": {
"type": "string",
"minLength": 1
},
"type": {
"type": "string",
"minLength": 1
}
}
}
}
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/device_search" \
-H "Authorization: Bearer <token>"

Пример ответа

[
{
"address": "string",
"vendor": "string",
"baudrate": 9600,
"subdevices": [
{
"address": "string",
"type": "string"
}
]
}
]

POST /device_search

Раздел: Устройства.

Запускает или останавливает поиск устройств.

Параметры и ответы по OpenAPI
{
"description": "Send search command",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"command"
],
"properties": {
"command": {
"type": "string",
"enum": [
"START",
"STOP"
]
},
"if1": {
"description": "RS485 interface 1",
"type": "object",
"required": [
"start_addr",
"stop_addr",
"baudrates"
],
"properties": {
"baudrates": {
"type": "array",
"minItems": 1,
"items": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
}
},
"start_addr": {
"type": "integer",
"minimum": 0,
"maximum": 126,
"description": "Device RS485 address to start device search from (inclusive)"
},
"stop_addr": {
"description": "Device RS485 address to stop device search at (inclusive)",
"type": "integer",
"minimum": 0,
"maximum": 126
}
}
},
"if2": {
"description": "RS485 interface 1",
"type": "object",
"required": [
"start_addr",
"stop_addr",
"baudrates"
],
"properties": {
"baudrates": {
"type": "array",
"items": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
}
},
"start_addr": {
"type": "integer",
"minimum": 0,
"maximum": 126,
"description": "Device RS485 address to start device search from (inclusive)"
},
"stop_addr": {
"description": "Device RS485 address to stop device search at (inclusive)",
"type": "integer",
"minimum": 0,
"maximum": 126
}
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Command successfully applied",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Invalid parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X POST "https://{IP_контроллера}/api/v1/device_search" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"command": "START",
"if1": {
"baudrates": [
9600
],
"start_addr": 1,
"stop_addr": 1
},
"if2": {
"baudrates": [
9600
],
"start_addr": 1,
"stop_addr": 1
}
}'

Пример тела запроса

{
"command": "START",
"if1": {
"baudrates": [
9600
],
"start_addr": 1,
"stop_addr": 1
},
"if2": {
"baudrates": [
9600
],
"start_addr": 1,
"stop_addr": 1
}
}

Пример ответа

{
"success": false,
"message": "string",
"data": {}
}

POST /device_search/save

Раздел: Устройства.

Сохраняет найденное устройство в системе.

Параметры и ответы по OpenAPI
{
"description": "Save device from search results to the system",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"address",
"uuid",
"name",
"baudrate",
"subdevices"
],
"properties": {
"address": {
"type": "string",
"minLength": 1
},
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"name": {
"type": "string",
"minLength": 1
},
"baudrate": {
"type": "number",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"description": "Subdevices parameters to save",
"type": "array",
"items": {
"type": "object",
"required": [
"address",
"name"
],
"properties": {
"address": {
"type": "string",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
}
}
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully added device from search results to the system",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Invaid parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"404": {
"description": "Specified device is not in search results",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"409": {
"description": "Device has already been added to the system",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X POST "https://{IP_контроллера}/api/v1/device_search/save" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"address": "string",
"uuid": "string",
"name": "string",
"baudrate": 9600,
"subdevices": [
{
"address": "string",
"name": "string"
}
]
}'

Пример тела запроса

{
"address": "string",
"uuid": "string",
"name": "string",
"baudrate": 9600,
"subdevices": [
{
"address": "string",
"name": "string"
}
]
}

Пример ответа

{
"success": false,
"message": "string",
"data": {}
}

GET /device_search/status

Раздел: Устройства.

Возвращает текущее состояние поиска устройств.

Параметры и ответы по OpenAPI
{
"description": "Get current device search status",
"responses": {
"200": {
"description": "Successfully returned device search status",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"enum": [
"STARTED",
"STOPPED"
]
},
"if1": {
"type": "object",
"required": [
"start_addr",
"stop_addr",
"progress"
],
"properties": {
"start_addr": {
"type": "integer",
"minimum": 1,
"maximum": 127,
"description": "Current search start address"
},
"stop_addr": {
"type": "integer",
"minimum": 1,
"maximum": 127,
"description": "Current search stop address"
},
"progress": {
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Current search progress"
}
}
},
"if2": {
"type": "object",
"required": [
"start_addr",
"stop_addr",
"progress"
],
"properties": {
"start_addr": {
"type": "integer",
"minimum": 1,
"maximum": 127,
"description": "Current search start address"
},
"stop_addr": {
"type": "integer",
"minimum": 1,
"maximum": 127,
"description": "Current search stop address"
},
"progress": {
"type": "integer",
"minimum": 0,
"maximum": 100,
"description": "Current search progress"
}
}
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/device_search/status" \
-H "Authorization: Bearer <token>"

Пример ответа

{
"status": "STARTED",
"if1": {
"start_addr": 1,
"stop_addr": 1,
"progress": 1
},
"if2": {
"start_addr": 1,
"stop_addr": 1,
"progress": 1
}
}

GET /devices

Раздел: Устройства.

Возвращает постраничный список устройств с параметрами

Источник в Teamly

Назначение

URL запроса

Возвращает постраничный список устройств с параметрами

https://{IP_контроллера}/api/v1/devices?page=1&page_size=30

Параметры запроса:

Наименование, * - обязательный

Описание

page* integer (query)

номер страницы вывода

page_size* integer (query)

количество записей на страницу

Варианты ответа:

Code 200 (Successfully returned list of registered devices) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

uuid*

string

pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Уникальный идентификатор контроллера

hw_uuid

string

Идентификатор OSDP устройства в системе Strazh

oui_code

string

Код производителя, из перечня приминяемых протокол OSDP

sw_ver

string

Версия ПО микроконтроллера stm

controller*

string

Серийный номер контроллера

address*

string

Адрес контроллера,

name*

string

minLength: 1

Имя контроллера в формате "серийный номер: название /адрес".

vendor

string

minLength: 1

Модель в формате "RUBEZH, название, серийный номер, версия"

baudrate

integer

Варианты

9600, 19200, 38400, 57600, 115200

Скорость передачи данных

subdevices* [{

control

boolean

False- выключен, true- включен

Контроль состояния линии

type*

string

minLength: 1

Тип датчика, например: input, output, tamper, link.

name*

string

minLength: 1

Название датчика, например: SENS, EXIT, DOOR и др

address*

string

minLength: 1

Адрес устройства

access_point*

string

uuid точки прохода, к которой привязано устройство

error_status

string

Статус ошибки по датчику. Например: "Обрыв линии", "Вскрытие корпуса". Если поле отсутствует, состояние норма

notification

string

maxLength: 36

uuid пользовательского уведомления

state

string

Варианты

пустое значение - не определено,

0 - разомкнут,

1- замкнут

Состояние датчика

is_in_use

boolean

Использование устройства в подсистеме

}]

Пример:

[{
"serial_num": "00002031",
"sw_ver": "0.22.2",
"model_name": "Контроллер STR20-IP",
"controller": "00002031",
"vendor_name": "RUBEZH",
"hw_uuid": "e11e4b32-f09c-40fe-a9c3-58a644c5fbfb",
"oui_code": "4256787",
"type": "father",
"uuid": "368436d0-4ab0-11f1-b0bd-2b71fa86ae43",
"address": "/0",
"name": "00002031: Контроллер STR20-IP /0",
"vendor": "RUBEZH, Контроллер STR20-IP (0.2), s/n:00002031, ver:0.22.2",
"newAddress": "",
"baudrate": 115200,
"subdevices": [{
"type": "input",
"name": "SENS 1",
"address": "/input/0",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "input",
"name": "SENS 2",
"address": "/input/1",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "tamper",
"name": "Tamper",
"address": "/tamper",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
},
{
"type": "link",
"name": "Link",
"address": "/link",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
}]
}]

Code 400 (Bad request parameters) - запрос не выполнен, неверно указаны параметры запроса

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Returns list of devices",
"parameters": [
{
"in": "query",
"name": "page",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
},
{
"in": "query",
"name": "page_size",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 50
}
}
],
"responses": {
"200": {
"description": "Successfully returned list of registered devices",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
}
},
"400": {
"description": "Bad parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Something went wrong. It seems there is a bug on server",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices?page=1" \
-H "Authorization: Bearer <token>"

Пример ответа

[
{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}
]

POST /devices/action

Раздел: Устройства.

Генерация аппаратного события

В Teamly есть два описания этого метода. Они приведены отдельно; коды ответов и состав полей различаются.

Описание Teamly 1

Источник в Teamly

Назначение

URL запроса

Генерация аппаратного события

https://{IP_контроллера}/api/v1/devices/action

Параметры запроса:

Название

Тип

Описание

action*

object (body)

тело запроса

BODY

Название

* - обязательный

Тип

Формат

Назначение

binary_data

string

номер карты в двоичном представлении

data*

string

Варианты:

нажатый символ,

номер карты в десятичном представлении,

данные состояния контакта - true - замкнут, false - разомкнут

передаваемые данные

device_addr*

string

адрес устройства на шине OSDP

subdev_addr*

string

адрес считывателя или контакта

subdev_type*

string

Варианты:

reader - считыватель

input - вход

output - выход

тип устройства

status

string

Варианты:

ОК - исправно

любое другое значение - ошибка оборудования

исправность оборудования

description

Варианты:

"Output is inactive" - реле выключено;

"Output is active" - реле включено

активация реле

timestamp

integer($int64)

unix временная метка события в миллисекундах

type*

string

Варианты:

CARD READ - поднесение карты к считывателю,

KEY PRESSED - нажатие кнопки кодонаборной панели считывателя,

DISCRETE INPUT EVENT - состояние контакта

STATUS - статус состояния

тип события

Пример:

URL запроса: POST
https://{IP_контроллера}/api/v1/

Пример данных указываемых в body “action *” запроса

Эмуляция нажатия кнопки кодонаборной панели считывателя

{
"data": "5555",
"device_addr": "/1/1",
"subdev_addr":"/reader/1",
"subdev_type":"reader",
"timestamp":1671556291250,
"type":"KEY PRESSED"
}

Эмуляция поднесения карты к считывателю

{
"binary_data": "00000100010011111010001100001110",
"data": "72327950",
"device_addr": "/1/1",
"subdev_addr": "/reader/1",
"subdev_type": "reader",
"timestamp": 1671556453738,
"type": "CARD READ"
}

Эмуляция сработки контакта

{
"data":
{
"state":true
},
"device_addr":"/1/1",
"subdev_addr":"/input/3",
"timestamp":1671556480309,
"type":"DISCRETE INPUT EVENT"
}

Эмуляция сработки реле

Пример с исправленным синтаксисом JSON

Добавлена запятая после subdev_type. Расхождение двух карточек метода этим не разрешается.

{
"device_addr" : "/1/4",
"subdev_addr" : "/output/1",
"subdev_type" : "output",
"status": "OK",
"description": "Output is inactive",
"type" : "STATUS"
}
Исходный пример Teamly

Пример из Teamly сохранён дословно, но не является корректным JSON.

{
"device_addr" : "/1/4",
"subdev_addr" : "/output/1",
"subdev_type" : "output"
"status": "OK",
"description": "Output is inactive",
"type" : "STATUS"
}

Варианты ответа:

Code 201 (Successfully simulated hardware event) - удачное выполнение запроса

Code 400 (Bad parameters) - запрос не выполнен, неверно указаны параметры запроса

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Описание Teamly 2

Источник в Teamly

Назначение

URL запроса

Генерирует аппаратное событие системы

https://{IP_контроллера}/api/v1/devices/action

Параметры запроса:

Параметры отсутствуют

В теле запроса доступны три варианта, в зависимости от действия с устройством

BODY (Эмуляция поднесения карты к считывателю)

Название

* - обязательный

Тип

Формат

Назначение

binary_data

string

номер карты в двоичном представлении

data*

string

номер карты в десятичном представлении

device_addr

string

адрес устройства на шине OSDP

subdev_addr

string

адрес считывателя

subdev_type

string

тип устройства (reader/input/output)

timestamp

string

unix временная метка события в миллисекундах

type*

[ CARD READ, KEY PRESSED ]

тип события:

CARD READ — чтение карты

KEY PRESSED — нажатие клавиши

BODY (Эмуляция смены состояния контакта)

Название

* - обязательный

Тип

Формат

Назначение

data*

string

Данные состояния контакта

error

string

номер карты в десятичном представлении

state*

boolean

true - замкнут
false - разомкнут

Состояние контакта

timestamp

string

unix временная метка события в миллисекундах

device_addr

string

адрес устройства на шине OSDP

subdev_addr

string

адрес контакта

subdev_type

string

тип устройства (reader/input/output)

type*

[ DISCRETE INPUT EVENT ]

тип события - состояние контакта

BODY (Эмуляция смены состояния контактов реле)

Название

* - обязательный

Тип

Формат

Назначение

description*

string

[ Output is active, Output is inactive ]

Положение контактов реле:

Output is active - включено
Output is inactiv - Выключено

device_addr

string

адрес устройства на шине OSDP

subdev_addr

string

адрес контакта

status

string

[ OK ]

Статус наличия связи с устройством

timestamp

string

unix временная метка события в миллисекундах

type*

string

[ STATUS ]

тип события - состояние контакта

Пример:

URL запроса: POST
https://{IP_контроллера}/api/v1/devices/action

Body:

Эмуляция поднесения карты к считывателю

{
"binary_data":"00000100010011111010001100001110",
"data":"72327950",
"device_addr":"/1/1",
"subdev_addr":"/reader/1",
"subdev_type":"reader",
"timestamp":1671556453738,
"type":"CARD READ"
}

Эмуляция смены состояния контакта

{
"data":
{
"state":true
},
"device_addr":"/1/1",
"subdev_addr":"/input/3",
"subdev_type":"input",
"timestamp":1671556480309,
"type":"DISCRETE INPUT EVENT"
}

Эмуляция смены состояния контактов реле

{
"device_addr" : "/2/1",
"subdev_addr" : "/output/0",
"timestamp":1671556480309,
"status": "OK",
"description": "Output is active",
"type" : "STATUS"
}

Варианты ответа:

Code 200 (Successfully) - удачное выполнение запроса

{
"success": true,
"message": "string"
}

Code 400 (Bad request parameters) - запрос не выполнен, неверно указаны параметры запроса

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Simulate hardware events",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"data",
"type"
],
"properties": {
"binary_data": {
"type": "string"
},
"data": {
"type": "string"
},
"device_addr": {
"type": "string"
},
"subdev_addr": {
"type": "string"
},
"subdev_type": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"type": {
"type": "string",
"enum": [
"CARD READ",
"KEY PRESSED"
]
}
}
},
{
"type": "object",
"required": [
"data",
"type"
],
"properties": {
"data": {
"type": "object",
"required": [
"state"
],
"properties": {
"error": {
"type": "string"
},
"state": {
"type": "boolean"
}
}
},
"timestamp": {
"type": "integer"
},
"device_addr": {
"type": "string"
},
"subdev_addr": {
"type": "string"
},
"subdev_type": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"DISCRETE INPUT EVENT"
]
}
}
},
{
"type": "object",
"required": [
"description",
"type"
],
"properties": {
"description": {
"type": "string",
"enum": [
"Output is active",
"Output is inactive"
]
},
"device_addr": {
"type": "string"
},
"subdev_addr": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"OK"
]
},
"timestamp": {
"type": "integer"
},
"type": {
"type": "string",
"enum": [
"STATUS"
]
}
}
}
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully simulated hardware event",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Bad parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X POST "https://{IP_контроллера}/api/v1/devices/action" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"binary_data": "string",
"data": "string",
"device_addr": "string",
"subdev_addr": "string",
"subdev_type": "string",
"timestamp": 1,
"type": "CARD READ"
}'

Пример тела запроса

{
"binary_data": "string",
"data": "string",
"device_addr": "string",
"subdev_addr": "string",
"subdev_type": "string",
"timestamp": 1,
"type": "CARD READ"
}

Пример ответа

{
"success": false,
"message": "string",
"data": {}
}

GET /devices/by_controller/{controller}

Раздел: Устройства.

Возвращает параметры контроллера и связанных с ним модулей по серийному номеру

Источник в Teamly

Назначение

URL запроса

Возвращает параметры контроллера и связанных с ним модулей по серийному номеру

https://{IP_контроллера}/api/v1/devices/by_controller/00000583

Параметры запроса:

Наименование, * - обязательный

Описание

controller* string (path)

серийный номер контроллера

Варианты ответа:

Code 200 (Successfully received devices on specified controller) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

uuid*

string

pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Уникальный идентификатор контроллера

hw_uuid

string

Идентификатор OSDP устройства в системе Strazh

oui_code

string

Код производителя, из перечня приминяемых протокол OSDP

sw_ver

string

Версия ПО микроконтроллера stm

controller*

string

Серийный номер контроллера

address*

string

Адрес контроллера,

name*

string

minLength: 1

Имя контроллера в формате "серийный номер: название /адрес".

vendor

string

minLength: 1

Модель в формате "RUBEZH, название, серийный номер, версия"

baudrate

integer

Варианты

9600, 19200, 38400, 57600, 115200

Скорость передачи данных

subdevices* [{

control

boolean

False- выключен, true- включен

Контроль состояния линии

type*

string

minLength: 1

Тип датчика, например: input, output, tamper, link.

name*

string

minLength: 1

Название датчика, например: SENS, EXIT, DOOR и др

address*

string

minLength: 1

Адрес устройства

access_point*

string

uuid точки прохода, к которой привязано устройство

error_status

string

Статус ошибки по датчику. Например: "Обрыв линии", "Вскрытие корпуса". Если поле отсутствует, состояние норма

notification

string

maxLength: 36

uuid пользовательского уведомления

state

string

Варианты

пустое значение - не определено,

0 - разомкнут,

1- замкнут

Состояние датчика

is_in_use

boolean

Использование устройства в подсистеме

}]

Пример:

[{
"serial_num": "00002031",
"sw_ver": "0.22.2",
"model_name": "Контроллер STR20-IP",
"controller": "00002031",
"vendor_name": "RUBEZH",
"hw_uuid": "e11e4b32-f09c-40fe-a9c3-58a644c5fbfb",
"oui_code": "4256787",
"type": "father",
"uuid": "368436d0-4ab0-11f1-b0bd-2b71fa86ae43",
"address": "/0",
"name": "00002031: Контроллер STR20-IP /0",
"vendor": "RUBEZH, Контроллер STR20-IP (0.2), s/n:00002031, ver:0.22.2",
"newAddress": "",
"baudrate": 115200,
"subdevices": [{
"type": "input",
"name": "SENS 1",
"address": "/input/0",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "input",
"name": "SENS 2",
"address": "/input/1",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "tamper",
"name": "Tamper",
"address": "/tamper",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
},
{
"type": "link",
"name": "Link",
"address": "/link",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
}]
}]

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Returns list of devices on specified controller",
"parameters": [
{
"in": "path",
"name": "controller",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully received devices on specified controller",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/by_controller/{controller}" \
-H "Authorization: Bearer <token>"

Пример ответа

[
{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}
]

GET /devices/controllers_list

Раздел: Устройства.

Возвращает список серийных номеров контроллеров

Источник в Teamly

Назначение

URL запроса

Возвращает список серийных номеров контроллеров

https://{IP_контроллера}/api/v1/devices/controllers_list

Параметры запроса:

Отсутствуют

Варианты ответа:

Code 200 (Successfully received devices controllers list) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

Без названия

String

серийный номер контроллера

Пример:

[
"00002041",
"00002040"
]

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Returns existing devices controllers list",
"responses": {
"200": {
"description": "Successfully received devices controllers list",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/controllers_list" \
-H "Authorization: Bearer <token>"

Пример ответа

[
"string"
]

GET /devices/count

Раздел: Устройства.

Возвращает количество добавленных в систему устройств

Источник в Teamly

Назначение

URL запроса

Возвращает количество добавленных в систему устройств

https://{IP_контроллера}/api/v1/devices/count

Параметры запроса:

Отсутствуют

Варианты ответа:

Code 200 (Successfully received devices count) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

count*

integer

minimum: 0

Количество устройств

Пример:

{
"count": 4
}

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Get devices count",
"responses": {
"200": {
"description": "Successfully received devices count",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"count"
],
"properties": {
"count": {
"type": "integer",
"minimum": 0
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/count" \
-H "Authorization: Bearer <token>"

Пример ответа

{
"count": 1
}

GET /devices/find

Раздел: Устройства.

Возвращает список параметров подключенного устройства по номеру контроллера и адресу в сегменте

Источник в Teamly

Назначение

URL запроса

Возвращает список параметров подключенного устройства по номеру контроллера и адресу в сегменте

https://{IP_контроллера}/api/v1/devices/find?controller=00000583&device_address=/1/1

Параметры запроса:

Наименование, * - обязательный

Описание

controller* string (query)

серийный номер контроллера

device_address* string (query)

адрес в сегменте

Варианты ответа:

Code 200 (Successfully found specified device) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

uuid*

string

pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Уникальный идентификатор контроллера

hw_uuid

string

Идентификатор OSDP устройства в системе Strazh

oui_code

string

Код производителя, из перечня приминяемых протокол OSDP

sw_ver

string

Версия ПО микроконтроллера stm

controller*

string

Серийный номер контроллера

address*

string

Адрес контроллера,

name*

string

minLength: 1

Имя контроллера в формате "серийный номер: название /адрес".

vendor

string

minLength: 1

Модель в формате "RUBEZH, название, серийный номер, версия"

baudrate

integer

Варианты

9600, 19200, 38400, 57600, 115200

Скорость передачи данных

subdevices* [{

control

boolean

False- выключен, true- включен

Контроль состояния линии

type*

string

minLength: 1

Тип датчика, например: input, output, tamper, link.

name*

string

minLength: 1

Название датчика, например: SENS, EXIT, DOOR и др

address*

string

minLength: 1

Адрес устройства

access_point*

string

uuid точки прохода, к которой привязано устройство

error_status

string

Статус ошибки по датчику. Например: "Обрыв линии", "Вскрытие корпуса". Если поле отсутствует, состояние норма

notification

string

maxLength: 36

uuid пользовательского уведомления

state

string

Варианты

пустое значение - не определено,

0 - разомкнут,

1- замкнут

Состояние датчика

is_in_use

boolean

Использование устройства в подсистеме

}]

Пример:

[{
"serial_num": "00002031",
"sw_ver": "0.22.2",
"model_name": "Контроллер STR20-IP",
"controller": "00002031",
"vendor_name": "RUBEZH",
"hw_uuid": "e11e4b32-f09c-40fe-a9c3-58a644c5fbfb",
"oui_code": "4256787",
"type": "father",
"uuid": "368436d0-4ab0-11f1-b0bd-2b71fa86ae43",
"address": "/0",
"name": "00002031: Контроллер STR20-IP /0",
"vendor": "RUBEZH, Контроллер STR20-IP (0.2), s/n:00002031, ver:0.22.2",
"newAddress": "",
"baudrate": 115200,
"subdevices": [{
"type": "input",
"name": "SENS 1",
"address": "/input/0",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "input",
"name": "SENS 2",
"address": "/input/1",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "tamper",
"name": "Tamper",
"address": "/tamper",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
},
{
"type": "link",
"name": "Link",
"address": "/link",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
}]
}]

Code 400 (Bad parameters) - запрос не выполнен, неверно указаны параметры запроса

Code 404 (Specified device does not exist) - запрос не выполнен, указанное устройство не существует

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Returns list of devices",
"parameters": [
{
"in": "query",
"name": "controller",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "device_address",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully found specified device",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
},
"400": {
"description": "Bad parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"404": {
"description": "Specified device does not exist",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/find?controller=<controller>&device_address=<device_address>" \
-H "Authorization: Bearer <token>"

Пример ответа

{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}

GET /devices/have_errors

Раздел: Устройства.

Возвращает постраничный список устройств с ошибками

Источник в Teamly

Назначение

URL запроса

Возвращает постраничный список устройств с ошибками

https://{IP_контроллера}/api/v1/devices/have_errors?page=1&page_size=30

Параметры запроса:

Наименование, * - обязательный

Описание

page* integer (query)

номер страницы вывода

page_size* integer (query)

количество записей на страницу

Варианты ответа:

Code 200 (Successfully returned list of devices with errors) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

uuid*

string

pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Уникальный идентификатор контроллера

hw_uuid

string

Идентификатор OSDP устройства в системе Strazh

oui_code

string

Код производителя, из перечня приминяемых протокол OSDP

sw_ver

string

Версия ПО микроконтроллера stm

controller*

string

Серийный номер контроллера

address*

string

Адрес контроллера,

name*

string

minLength: 1

Имя контроллера в формате "серийный номер: название /адрес".

vendor

string

minLength: 1

Модель в формате "RUBEZH, название, серийный номер, версия"

baudrate

integer

Варианты

9600, 19200, 38400, 57600, 115200

Скорость передачи данных

subdevices* [{

control

boolean

False- выключен, true- включен

Контроль состояния линии

type*

string

minLength: 1

Тип датчика, например: input, output, tamper, link.

name*

string

minLength: 1

Название датчика, например: SENS, EXIT, DOOR и др

address*

string

minLength: 1

Адрес устройства

access_point*

string

uuid точки прохода, к которой привязано устройство

error_status

string

Статус ошибки по датчику. Например: "Обрыв линии", "Вскрытие корпуса". Если поле отсутствует, состояние норма

notification

string

maxLength: 36

uuid пользовательского уведомления

state

string

Варианты

пустое значение - не определено,

0 - разомкнут,

1- замкнут

Состояние датчика

is_in_use

boolean

Использование устройства в подсистеме

}]

Пример:

[{
"serial_num": "00002031",
"sw_ver": "0.22.2",
"model_name": "Контроллер STR20-IP",
"controller": "00002031",
"vendor_name": "RUBEZH",
"hw_uuid": "e11e4b32-f09c-40fe-a9c3-58a644c5fbfb",
"oui_code": "4256787",
"type": "father",
"uuid": "368436d0-4ab0-11f1-b0bd-2b71fa86ae43",
"address": "/0",
"name": "00002031: Контроллер STR20-IP /0",
"vendor": "RUBEZH, Контроллер STR20-IP (0.2), s/n:00002031, ver:0.22.2",
"newAddress": "",
"baudrate": 115200,
"subdevices": [{
"type": "input",
"name": "SENS 1",
"address": "/input/0",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "input",
"name": "SENS 2",
"address": "/input/1",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "tamper",
"name": "Tamper",
"address": "/tamper",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
},
{
"type": "link",
"name": "Link",
"address": "/link",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
}]
}]

Code 400 (Bad parameters) - запрос не выполнен, неверно указаны параметры запроса

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Returns list of devices that have errors",
"parameters": [
{
"in": "query",
"name": "page",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
},
{
"in": "query",
"name": "page_size",
"required": true,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 50
}
}
],
"responses": {
"200": {
"description": "Successfully returned list of devices with errors",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
}
},
"400": {
"description": "Bad parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Something went wrong. It seems there is a bug on server",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/have_errors?page=1&page_size=1" \
-H "Authorization: Bearer <token>"

Пример ответа

[
{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}
]

GET /devices/have_notifications

Раздел: Устройства.

Возвращает постраничный список устройств с событиями оповещения

Источник в Teamly

Назначение

URL запроса

Возвращает постраничный список устройств с событиями оповещения

https://{IP_контроллера}/api/v1/devices/have_notifications?page=1&page_size=30

Параметры запроса:

Наименование, * - обязательный

Описание

page* integer (query)

номер страницы вывода

page_size* integer(query)

количество записей на страницу

Варианты ответа:

Code 200 (Successfully returned list of devices active notifications) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

uuid*

string

pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Уникальный идентификатор контроллера

hw_uuid

string

Идентификатор OSDP устройства в системе Strazh

oui_code

string

Код производителя, из перечня приминяемых протокол OSDP

sw_ver

string

Версия ПО микроконтроллера stm

controller*

string

Серийный номер контроллера

address*

string

Адрес контроллера,

name*

string

minLength: 1

Имя контроллера в формате "серийный номер: название /адрес".

vendor

string

minLength: 1

Модель в формате "RUBEZH, название, серийный номер, версия"

baudrate

integer

Варианты

9600, 19200, 38400, 57600, 115200

Скорость передачи данных

subdevices* [{

control

boolean

False- выключен, true- включен

Контроль состояния линии

type*

string

minLength: 1

Тип датчика, например: input, output, tamper, link.

name*

string

minLength: 1

Название датчика, например: SENS, EXIT, DOOR и др

address*

string

minLength: 1

Адрес устройства

access_point*

string

uuid точки прохода, к которой привязано устройство

error_status

string

Статус ошибки по датчику. Например: "Обрыв линии", "Вскрытие корпуса". Если поле отсутствует, состояние норма

notification

string

maxLength: 36

uuid пользовательского уведомления

state

string

Варианты

пустое значение - не определено,

0 - разомкнут,

1- замкнут

Состояние датчика

is_in_use

boolean

Использование устройства в подсистеме

}]

Пример:

[{
"serial_num": "00002031",
"sw_ver": "0.22.2",
"model_name": "Контроллер STR20-IP",
"controller": "00002031",
"vendor_name": "RUBEZH",
"hw_uuid": "e11e4b32-f09c-40fe-a9c3-58a644c5fbfb",
"oui_code": "4256787",
"type": "father",
"uuid": "368436d0-4ab0-11f1-b0bd-2b71fa86ae43",
"address": "/0",
"name": "00002031: Контроллер STR20-IP /0",
"vendor": "RUBEZH, Контроллер STR20-IP (0.2), s/n:00002031, ver:0.22.2",
"newAddress": "",
"baudrate": 115200,
"subdevices": [{
"type": "input",
"name": "SENS 1",
"address": "/input/0",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "input",
"name": "SENS 2",
"address": "/input/1",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "tamper",
"name": "Tamper",
"address": "/tamper",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
},
{
"type": "link",
"name": "Link",
"address": "/link",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
}]
}]

Code 400 (Bad parameters) - запрос не выполнен, неверно указаны параметры запроса

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Returns list of devices that have active notifications",
"parameters": [
{
"in": "query",
"name": "page",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
},
{
"in": "query",
"name": "page_size",
"required": true,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 50
}
}
],
"responses": {
"200": {
"description": "Successfully returned list of devices active notifications",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
}
},
"400": {
"description": "Bad parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Something went wrong. It seems there is a bug on server",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/have_notifications?page=1&page_size=1" \
-H "Authorization: Bearer <token>"

Пример ответа

[
{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}
]

GET /devices/{uuid}

Раздел: Устройства.

Возвращает параметры устройства по его uuid

Источник в Teamly

Назначение

URL запроса

Возвращает параметры устройства по его uuid

https://{IP_контроллера}/api/v1/devices/c71d5e10-8430-11ec-8258-e738990759a4

Параметры запроса:

Наименование, * - обязательный

Описание

uuid* string (path)

uuid устройства

Варианты ответа:

Code 200 (Successfully returned device data) - удачное выполнение запроса

Название, * - обязательный

Тип

Формат

Назначение

uuid*

string

pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Уникальный идентификатор контроллера

hw_uuid

string

Идентификатор OSDP устройства в системе Strazh

oui_code

string

Код производителя, из перечня приминяемых протокол OSDP

sw_ver

string

Версия ПО микроконтроллера stm

controller*

string

Серийный номер контроллера

address*

string

Адрес контроллера,

name*

string

minLength: 1

Имя контроллера в формате "серийный номер: название /адрес".

vendor

string

minLength: 1

Модель в формате "RUBEZH, название, серийный номер, версия"

baudrate

integer

Варианты

9600, 19200, 38400, 57600, 115200

Скорость передачи данных

subdevices* [{

control

boolean

False- выключен, true- включен

Контроль состояния линии

type*

string

minLength: 1

Тип датчика, например: input, output, tamper, link.

name*

string

minLength: 1

Название датчика, например: SENS, EXIT, DOOR и др

address*

string

minLength: 1

Адрес устройства

access_point*

string

uuid точки прохода, к которой привязано устройство

error_status

string

Статус ошибки по датчику. Например: "Обрыв линии", "Вскрытие корпуса". Если поле отсутствует, состояние норма

notification

string

maxLength: 36

uuid пользовательского уведомления

state

string

Варианты

пустое значение - не определено,

0 - разомкнут,

1- замкнут

Состояние датчика

is_in_use

boolean

Использование устройства в подсистеме

}]

Пример:

{
"serial_num": "00002031",
"sw_ver": "0.22.2",
"model_name": "Контроллер STR20-IP",
"controller": "00002031",
"vendor_name": "RUBEZH",
"hw_uuid": "e11e4b32-f09c-40fe-a9c3-58a644c5fbfb",
"oui_code": "4256787",
"type": "father",
"uuid": "368436d0-4ab0-11f1-b0bd-2b71fa86ae43",
"address": "/0",
"name": "00002031: Контроллер STR20-IP /0",
"vendor": "RUBEZH, Контроллер STR20-IP (0.2), s/n:00002031, ver:0.22.2",
"newAddress": "",
"baudrate": 115200,
"subdevices": [{
"type": "input",
"name": "SENS 1",
"address": "/input/0",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "input",
"name": "SENS 2",
"address": "/input/1",
"access_point": "",
"description": "",
"actual_state": "false",
"control": false,
"is_in_use": false
},
{
"type": "tamper",
"name": "Tamper",
"address": "/tamper",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
},
{
"type": "link",
"name": "Link",
"address": "/link",
"access_point": "",
"description": "",
"control": false,
"is_in_use": true
}]
}

Code 400 (Invalid UUID) - запрос не выполнен, указан некорректный uuid

Code 404 (Specified device does not exist) - запрос не выполнен, указанное устройство не существует

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Get device by UUID",
"parameters": [
{
"in": "path",
"name": "uuid",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Successfully returned device data",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
},
"400": {
"description": "Invalid UUID",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"404": {
"description": "Specified device does not exist",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Something went wrong. It seems there is a bug on server",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X GET "https://{IP_контроллера}/api/v1/devices/{uuid}" \
-H "Authorization: Bearer <token>"

Пример ответа

{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}

PUT /devices/{uuid}

Раздел: Устройства.

Изменяет данные устройства.

Параметры и ответы по OpenAPI
{
"description": "Modify device data",
"parameters": [
{
"in": "path",
"name": "uuid",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"uuid",
"controller",
"address",
"name",
"subdevices"
],
"properties": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[089abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
},
"controller": {
"type": "string",
"description": "Controller serial"
},
"address": {
"type": "string"
},
"name": {
"type": "string",
"minLength": 1
},
"vendor": {
"type": "string",
"minLength": 1
},
"access_point": {
"type": "string"
},
"baudrate": {
"type": "integer",
"enum": [
9600,
19200,
38400,
57600,
115200
]
},
"subdevices": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"address",
"name",
"access_point"
],
"properties": {
"control": {
"type": "boolean",
"description": "Line control notify"
},
"type": {
"type": "string",
"description": "Subdevice type",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"address": {
"type": "string",
"minLength": 1,
"description": "Subdevice address inside host device"
},
"access_point": {
"type": "string",
"description": "UUID of access point to which this subdevice attached"
},
"error_status": {
"type": "string"
},
"notification": {
"type": "string",
"maxLength": 36,
"description": "Attached user defined notification UUID"
},
"state": {
"type": "string",
"enum": [
"",
"0",
"1"
]
},
"is_in_use": {
"type": "boolean",
"description": "Indicates that subdevice is used in system"
}
}
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully modified device",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Bad request parameters",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"404": {
"description": "Specified device does not exist",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Something went wrong. It seems there is a bug on server",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X PUT "https://{IP_контроллера}/api/v1/devices/{uuid}" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}'

Пример тела запроса

{
"uuid": "string",
"controller": "string",
"address": "string",
"name": "string",
"vendor": "string",
"access_point": "string",
"baudrate": 9600,
"subdevices": [
{
"control": true,
"type": "string",
"name": "string",
"address": "string",
"access_point": "string",
"error_status": "string",
"notification": "string",
"state": "",
"is_in_use": true
}
]
}

Пример ответа

{
"success": false,
"message": "string",
"data": {}
}

DELETE /devices/{uuid}

Раздел: Устройства.

Позволяет удалить устройство с определенным UUID

Источник в Teamly

Назначение

URL запроса

Позволяет удалить устройство с определенным UUID

https://{IP_контроллера}/api/v1/devices/e11e4b32-f09c-40fe-a9c3-58a644c5fbfb

Параметры запроса:

Наименование, * - обязательный

Описание

uuid* string (path)

существующий uuid устройства

Варианты ответа:

Code 200 (Successfully deleted device) - удачное выполнение запроса

Code 400 (UUID is not valid) - запрос не выполнен, uuid недействителен

Code 500 (Unexpected server error) - запрос не выполнен получено сообщение об ошибке

Параметры и ответы по OpenAPI
{
"description": "Deletes device with specified UUID",
"parameters": [
{
"in": "path",
"name": "uuid",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Successfully deleted device",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "UUID is not valid",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
}
}
}

Примеры по OpenAPI

Сформированы по схеме контроллера; значения полей необходимо заменить.

Пример запроса

curl -k -X DELETE "https://{IP_контроллера}/api/v1/devices/{uuid}" \
-H "Authorization: Bearer <token>"

Пример ответа

{
"success": false,
"message": "string",
"data": {}
}