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

События управления устройствами API 1.7.0

Методы API для работы с разделом «События управления устройствами».

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

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

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

МетодПуть
POST/device_management/send_event
POST/device_management/send_pass_event

POST /device_management/send_event

Раздел: События управления устройствами.

Генерация аппаратной команды на реле.

Параметры и ответы по OpenAPI
{
"description": "custom device management event",
"requestBody": {
"description": "Send device event",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"type",
"device_addr",
"subdev_addr",
"subdev_type"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"error": {
"type": "string",
"default": ""
},
"state": {
"type": "boolean",
"default": true
},
"temporary": {
"type": "boolean",
"default": true
},
"time": {
"type": "number"
}
}
},
"device_addr": {
"type": "string"
},
"subdev_addr": {
"type": "string"
},
"subdev_type": {
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully post device event",
"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 POST "https://{IP_контроллера}/api/v1/device_management/send_event" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"type": "string",
"data": {
"error": "",
"state": true,
"temporary": true,
"time": 1.0
},
"device_addr": "string",
"subdev_addr": "string",
"subdev_type": "string"
}'

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

{
"type": "string",
"data": {
"error": "",
"state": true,
"temporary": true,
"time": 1.0
},
"device_addr": "string",
"subdev_addr": "string",
"subdev_type": "string"
}

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

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

POST /device_management/send_pass_event

Раздел: События управления устройствами.

Генерация аппаратной команды на разрешение разового прохода

Источник в Teamly

Назначение

URL запроса

Генерация аппаратной команды на разрешение разового прохода

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

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

Название

Тип

Описание

Название параметра*

query/body/path

Описание параметра

BODY

Название

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

Тип

Формат

Назначение

data

Описание поля

error

string

По умолчанию пустая строка.

Текст ошибки, если есть

state

boolean

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

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

temporary

boolean

По умолчанию: true

признак разового прохода

time

number

timestamp

время действия команды в мс.

device_addr*

string

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

subdev_addr*

string

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

subdev_type*

string

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

Пример:

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

Body

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

Имена полей заключены в кавычки JSON.

{
"controller": "00001119",
"device_addr": "/1/3",
"subdev_addr": "/output/0",
"subdev_type": "lock"
}
Исходный пример Teamly

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

{
controller: "00001119",
device_addr: "/1/3",
subdev_addr: "/output/0",
subdev_type: "lock"
}

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

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

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

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

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

Параметры и ответы по OpenAPI
{
"description": "device management pass event",
"requestBody": {
"description": "Send device pass event",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"device_addr",
"subdev_addr",
"subdev_type"
],
"properties": {
"data": {
"type": "object",
"properties": {
"error": {
"type": "string",
"default": ""
},
"state": {
"type": "boolean",
"default": true
},
"temporary": {
"type": "boolean",
"default": true
},
"time": {
"type": "number"
}
}
},
"device_addr": {
"type": "string"
},
"subdev_addr": {
"type": "string"
},
"subdev_type": {
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully post pass event",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "No access to controller",
"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 POST "https://{IP_контроллера}/api/v1/device_management/send_pass_event" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"data": {
"error": "",
"state": true,
"temporary": true,
"time": 1.0
},
"device_addr": "string",
"subdev_addr": "string",
"subdev_type": "string"
}'

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

{
"data": {
"error": "",
"state": true,
"temporary": true,
"time": 1.0
},
"device_addr": "string",
"subdev_addr": "string",
"subdev_type": "string"
}

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

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