Прошивки API 1.7.0
Методы API для работы с разделом «Прошивки».
Базовый путь: https://{IP_контроллера}/api/v1.
Версия описания API: 1.7.0.
Примеры используют placeholder-значения для паролей, token, UUID, адресов и секретов. Перед выполнением запроса замените их на значения вашего контроллера.
Методы раздела
| Метод | Путь |
|---|---|
GET | /firmware_update |
POST | /firmware_update |
POST | /firmware_update/cancel |
POST | /firmware_update/install |
GET | /firmware_update/status |
POST | /firmware_update/upload |
GET /firmware_update
Раздел: Прошивки.
Возвращает статус обновления прошивки.
Параметры и ответы по OpenAPI
{
"description": "Get firmware update status",
"responses": {
"200": {
"description": "Returned firmware update status",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"enum": [
"STARTED",
"STOPPED",
"NEED RESTART"
]
},
"progress": {
"description": "Firmware update progress",
"type": "integer",
"minimum": 0,
"maximum": 100
},
"stage": {
"description": "Firmware update stage",
"type": "string"
},
"error_status": {
"description": "If error occured during update",
"type": "string"
}
}
}
}
}
}
},
"deprecated": true
}
Примеры по OpenAPI
Сформированы по схеме контроллера; значения полей необходимо заменить.
Пример запроса
curl -k -X GET "https://{IP_контроллера}/api/v1/firmware_update" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"status": "STARTED",
"progress": 1,
"stage": "string",
"error_status": "string"
}
POST /firmware_update
Раздел: Прошивки.
Запускает обновление прошивки.
Параметры и ответы по OpenAPI
{
"description": "Start firmware update",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"upload_file_size": {
"type": "integer",
"minimum": 1,
"description": "Optional size of uploaded file in bytes"
},
"update_file": {
"type": "string",
"format": "binary",
"description": "Firmware file to upload"
}
},
"required": [
"update_file"
]
}
}
}
},
"responses": {
"200": {
"description": "Firmware update started",
"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"
}
}
}
}
}
},
"409": {
"description": "Firmware update already in progress",
"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"
}
}
}
}
}
}
},
"deprecated": true
}
Примеры по OpenAPI
Сформированы по схеме контроллера; значения полей необходимо заменить.
Пример запроса
curl -k -X POST "https://{IP_контроллера}/api/v1/firmware_update" \
-H "Authorization: Bearer <token>" \
--form-string upload_file_size=1 \
--form 'update_file=@/path/to/update_file;type=application/octet-stream'
Пример ответа
{
"success": false,
"message": "string",
"data": {}
}
POST /firmware_update/cancel
Раздел: Прошивки.
Отменяет установку прошивки
Назначение | URL запроса |
Отменяет установку прошивки | https://{IP_контроллера}/api/v1/firmware_update/cancel |
Параметры запроса:
Отсутствуют
Варианты ответа:
Code 200 (Successfully) - удачное выполнение запроса
{
"success": false,
"message": "string",
"data": {}
}
Code 400 (Bad request parameters) - запрос не выполнен, неверно указаны параметры запроса
Code 409 (Firmware update already in progress) - запрос не выполнен, обновление прошивки уже запущено
Code 500 (Unexpected server error) - запрос не выполнен, получено сообщение об ошибке
Параметры и ответы по OpenAPI
{
"description": "Cancel firmware install",
"responses": {
"200": {
"description": "Firmware update started",
"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"
}
}
}
}
}
},
"409": {
"description": "Firmware update already in progress",
"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/firmware_update/cancel" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"success": false,
"message": "string",
"data": {}
}
POST /firmware_update/install
Раздел: Прошивки.
Запускает установку прошивки
Назначение | URL запроса |
Запускает установку прошивки | https://{IP_контроллера}/api/v1/firmware_update/install |
Параметры запроса:
Отсутствуют
Варианты ответа:
Code 200 (Firmware update started) - удачное выполнение запроса
{
"success": false,
"message": "string",
"data": {}
}
Code 400 (Bad request parameters) - запрос не выполнен, неверно указаны параметры запроса
Code 409 (Firmware update already in progress) - запрос не выполнен, обновление прошивки уже запущено
Code 500 (Unexpected server error) - запрос не выполнен, получено сообщение об ошибке
Параметры и ответы по OpenAPI
{
"description": "Start firmware install",
"responses": {
"200": {
"description": "Firmware update started",
"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"
}
}
}
}
}
},
"409": {
"description": "Firmware update already in progress",
"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/firmware_update/install" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"success": false,
"message": "string",
"data": {}
}
GET /firmware_update/status
Раздел: Прошивки.
Возвращает статус обновления прошивки
Назначение | URL запроса |
Возвращает статус обновления прошивки | https://{IP_контроллера}/api/v1/firmware_update/status |
Параметры запроса:
Отсутствуют
Варианты ответа:
Code 200 (Returned firmware update status) - удачное выполнение запроса
Название, * - обязательный | Тип | Формат | Назначение |
status* | string | [ STARTED, STOPPED, NEED RESTART ] | Статус обновления прошивки |
progress | integer | minimum: 0 | Прогресс обновления в процентах |
stage | string | Этап обновления | |
error_status | string | Статус ошибки обновления (при наличии) |
Пример:
{
"status": "STARTED",
"progress": 100,
"stage": "string",
"error_status": "string"
}
Code 500 (Unexpected server error) - запрос не выполнен, получено сообщение об ошибке
Параметры и ответы по OpenAPI
{
"description": "Get firmware update status",
"responses": {
"200": {
"description": "Returned firmware update status",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"enum": [
"STARTED",
"STOPPED",
"NEED RESTART"
]
},
"progress": {
"description": "Firmware update progress",
"type": "integer",
"minimum": 0,
"maximum": 100
},
"stage": {
"description": "Firmware update stage",
"type": "string"
},
"error_status": {
"description": "If error occured during update",
"type": "string"
}
}
}
}
}
}
}
}
Примеры по OpenAPI
Сформированы по схеме контроллера; значения полей необходимо заменить.
Пример запроса
curl -k -X GET "https://{IP_контроллера}/api/v1/firmware_update/status" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"status": "STARTED",
"progress": 1,
"stage": "string",
"error_status": "string"
}
POST /firmware_update/upload
Раздел: Прошивки.
Запускает загрузку прошивки
Назначение | URL запроса |
Запускает загрузку прошивки | https://{IP_контроллера}/api/v1/firmware_update/upload |
Параметры запроса:
Название | Тип | Описание | |
upload* | object(body) | Тело запроса | |
BODY | |||
Название * - обязательный | Тип | Формат | Назначение |
upload_file_size | integer | Размер загружаемого файла в байтах | |
update_file* | string | $binary | Файл прошивки в бинарном виде |
Пример:
URL запроса: POST
https://{IP_контроллера}/api/v1/firmware_update/upload
Body
Пример из Teamly сохранён дословно, но не является корректным JSON.
{
'upload_file_size=34567' \-F
'update_file=@STR_ALM_5.1_1.2.1.bin;type=application/octet-stream'
}
Варианты ответа:
Code 200 (Firmware upload) - удачное выполнение запроса
{
"success": false,
"message": "string",
"data": {}
}
Code 400 (Bad request parameters) - запрос не выполнен, неверно указаны параметры запроса
Code 409 (Firmware update already in progress) - запрос не выполнен, обновление прошивки уже запущено
Code 500 (Unexpected server error) - запрос не выполнен, получено сообщение об ошибке
Параметры и ответы по OpenAPI
{
"description": "Start firmware upload",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"upload_file_size": {
"type": "integer",
"minimum": 1,
"description": "Optional size of uploaded file in bytes"
},
"update_file": {
"type": "string",
"format": "binary",
"description": "Firmware file to upload"
}
},
"required": [
"update_file"
]
}
}
}
},
"responses": {
"200": {
"description": "Firmware upload",
"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"
}
}
}
}
}
},
"409": {
"description": "Firmware update already in progress",
"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/firmware_update/upload" \
-H "Authorization: Bearer <token>" \
--form-string upload_file_size=1 \
--form 'update_file=@/path/to/update_file;type=application/octet-stream'
Пример ответа
{
"success": false,
"message": "string",
"data": {}
}