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

Конфигурация API 1.7.0

Методы API для работы с разделом «Конфигурация».

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

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

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

МетодПуть
GET/date_time
POST/date_time
GET/date_time/timezones
GET/network
POST/network

GET /date_time

Раздел: Конфигурация.

Получает настройки даты и времени контроллера

Источник в Teamly

Назначение

URL запроса

Получает настройки даты и времени контроллера

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

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

Отсутствуют

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

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

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

Тип

Формат

Назначение

ntp*

boolean

Использование ntp сервера

ntp_server

string

minLength: 1

Имя ntp сервера

timestamp

integer

$int64

UTC UNIX временная метка в миллисекундах

timezone*

string

Один из часовых поясов полученных GET запросом timezones

Пример:

{
"ntp": true,
"ntp_server": "string",
"timestamp": 0,
"timezone": "string"
}

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

Параметры и ответы по OpenAPI
{
"description": "Get current date/time and timezone",
"responses": {
"200": {
"description": "Successfully received current date/time",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ntp",
"timezone"
],
"properties": {
"ntp": {
"type": "boolean",
"description": "Using ntp server"
},
"ntp_server": {
"type": "string",
"minLength": 1
},
"timestamp": {
"type": "integer",
"format": "int64",
"description": "UTC UNIX timestamp in milliseconds"
},
"timezone": {
"type": "string",
"description": "One of returned by GET on timezones request"
}
}
}
}
}
},
"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/date_time" \
-H "Authorization: Bearer <token>"

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

{
"ntp": true,
"ntp_server": "string",
"timestamp": 1,
"timezone": "string"
}

POST /date_time

Раздел: Конфигурация.

Устанавливает время и дату контроллера

Источник в Teamly

Назначение

URL запроса

Устанавливает время и дату контроллера

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

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

Название

Тип

Описание

date_time*

object (body)

Тело запроса

BODY

Название

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

Тип

Формат

Назначение

ntp*

boolean

Использование ntp сервера

ntp_server

string

minLength: 1

Имя ntp сервера

timestamp

integer

$int64

UTC UNIX временная метка в миллисекундах

timezone*

string

Один из часовых поясов полученных GET запросом timezones

Пример:

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

Body

{
"ntp": false,
"timestamp": 1646087033016,
"timezone": "Europe/Moscow"
}

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

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

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

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

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

Параметры и ответы по OpenAPI
{
"description": "Set current date/time and timezone",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ntp",
"timezone"
],
"properties": {
"ntp": {
"type": "boolean",
"description": "Using ntp server"
},
"ntp_server": {
"type": "string",
"minLength": 1
},
"timestamp": {
"type": "integer",
"format": "int64",
"description": "UTC UNIX timestamp in milliseconds"
},
"timezone": {
"type": "string",
"description": "One of returned by GET on timezones request"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully set new date/time",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Invalid date/time 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/date_time" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"ntp": true,
"ntp_server": "string",
"timestamp": 1,
"timezone": "string"
}'

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

{
"ntp": true,
"ntp_server": "string",
"timestamp": 1,
"timezone": "string"
}

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

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

GET /date_time/timezones

Раздел: Конфигурация.

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

Источник в Teamly

Назначение

URL запроса

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

https://{IP_контроллера}/api/v1/date_time​/timezones

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

Отсутствуют

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

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

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

Тип

Формат

Назначение

name*

string

Название часового пояма

offset*

integer

Смещение времени относительно UTC

offset_string*

string

Определения разницы во времени относительно всемирного координированного времени (UTC)

Пример:

[
{
"name": "string",
"offset": 0,
"offset_string": "string"
}
]

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

Параметры и ответы по OpenAPI
{
"description": "Returns available timezones with their offsets",
"responses": {
"200": {
"description": "Successfully received timezones",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"offset",
"offset_string"
],
"properties": {
"name": {
"type": "string"
},
"offset": {
"type": "integer"
},
"offset_string": {
"type": "string"
}
}
}
}
}
}
}
}
}

Примеры по OpenAPI

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

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

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

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

[
{
"name": "string",
"offset": 1,
"offset_string": "string"
}
]

GET /network

Раздел: Конфигурация.

Получает сетевые настройки контроллера

Источник в Teamly

Назначение

URL запроса

Получает сетевые настройки контроллера

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

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

Отсутствуют

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

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

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

Тип

Формат

Назначение

dhcp*

boolean

Включение DHCP сервера

address

string

pattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

IP-адрес контроллера

netmask

string

pattern: ^(((255\.){3}(255|254|252|248|240|224|192|128|0+))|((255\.){2}(255|254|252|248|240|224|192|128|0+)\.0)|((255\.)(255|254|252|248|240|224|192|128|0+)(\.0+){2})|((255|254|252|248|240|224|192|128|0+)(\.0+){3}))$

Маска подсети

gateway

string

pattern:^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

Шлюз

dns1

string

pattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

Система доменных имен 1

dns2

string

pattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

Система доменных имен 2

mac_address

string

MAC-адрес контроллера

Пример:

{
"dhcp": true,
"address": "string",
"netmask": "string",
"gateway": "string",
"dns1": "string",
"dns2": "string",
"mac_address": "string"
}

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

Параметры и ответы по OpenAPI
{
"description": "Get network configuration",
"responses": {
"200": {
"description": "Successfully sent network configuration",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"dhcp"
],
"properties": {
"dhcp": {
"type": "boolean"
},
"address": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"netmask": {
"type": "string",
"pattern": "^(((255\\.){3}(255|254|252|248|240|224|192|128|0+))|((255\\.){2}(255|254|252|248|240|224|192|128|0+)\\.0)|((255\\.)(255|254|252|248|240|224|192|128|0+)(\\.0+){2})|((255|254|252|248|240|224|192|128|0+)(\\.0+){3}))$"
},
"gateway": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"dns1": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"dns2": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"mac_address": {
"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/network" \
-H "Authorization: Bearer <token>"

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

{
"dhcp": true,
"address": "string",
"netmask": "string",
"gateway": "string",
"dns1": "string",
"dns2": "string",
"mac_address": "string"
}

POST /network

Раздел: Конфигурация.

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

Источник в Teamly

Назначение

URL запроса

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

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

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

Название

Тип

Описание

network*

object (body)

Тело запроса

BODY

Название

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

Тип

Формат

Назначение

dhcp*

boolean

Использование dhcp-сервера

address

string

pattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

IP-адрес контроллера

netmask

string

pattern: ^(((255\.){3}(255|254|252|248|240|224|192|128|0+))|((255\.){2}(255|254|252|248|240|224|192|128|0+)\.0)|((255\.)(255|254|252|248|240|224|192|128|0+)(\.0+){2})|((255|254|252|248|240|224|192|128|0+)(\.0+){3}))$

Маска подсети

gateway

string

pattern:^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

Шлюз

dns1

string

pattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

Система доменных имен 1

dns2

string

pattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$

Система доменных имен 2

mac_address

string

MAC-адрес контроллера

Пример:

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

Body

{
"dhcp": true,
"address": "172.22.32.8",
"netmask": "255.255.0.0",
"gateway": "172.22.34.19",
"mac_address": "40:f5:13:80:06:64",
"dns1": "172.22.0.100",
"dns2": "172.22.0.101"
}

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

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

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

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

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

Параметры и ответы по OpenAPI
{
"description": "Set new network configuration",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"dhcp"
],
"properties": {
"dhcp": {
"type": "boolean"
},
"address": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"netmask": {
"type": "string",
"pattern": "^(((255\\.){3}(255|254|252|248|240|224|192|128|0+))|((255\\.){2}(255|254|252|248|240|224|192|128|0+)\\.0)|((255\\.)(255|254|252|248|240|224|192|128|0+)(\\.0+){2})|((255|254|252|248|240|224|192|128|0+)(\\.0+){3}))$"
},
"gateway": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"dns1": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"dns2": {
"type": "string",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
},
"mac_address": {
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully set new network configuration",
"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/network" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"dhcp": true,
"address": "string",
"netmask": "string",
"gateway": "string",
"dns1": "string",
"dns2": "string",
"mac_address": "string"
}'

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

{
"dhcp": true,
"address": "string",
"netmask": "string",
"gateway": "string",
"dns1": "string",
"dns2": "string",
"mac_address": "string"
}

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

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