Резервное копирование API 1.7.0
Методы API для работы с разделом «Резервное копирование».
Базовый путь: https://{IP_контроллера}/api/v1.
Версия описания API: 1.7.0.
Примеры используют placeholder-значения для паролей, token, UUID, адресов и секретов. Перед выполнением запроса замените их на значения вашего контроллера.
Методы раздела
| Метод | Путь |
|---|---|
GET | /backup/calculation |
GET | /backup/image_pack/{number} |
POST | /backup/notify/{type} |
POST | /backup/pack |
GET | /backup/pack/{number} |
GET | /backup/pack_size |
GET | /backup/redis-dump/{dbs} |
POST | /backup/redis-restore |
GET /backup/calculation
Раздел: Резервное копирование.
Возвращает общее количество объектов и пакетов резервной копии.
Параметры и ответы по OpenAPI
{
"description": "Calculate overall backup objects and packs count",
"parameters": [
{
"in": "query",
"name": "events",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get events backup"
},
{
"in": "query",
"name": "staff",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get staff backup"
},
{
"in": "query",
"name": "devices",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get devices backup"
},
{
"in": "query",
"name": "skd_config",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get configuration backup"
}
],
"responses": {
"200": {
"description": "Successfully get backup",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"objects_count",
"packs_count",
"images_count",
"images_packs_count",
"max_objects_in_pack",
"max_images_in_pack"
],
"properties": {
"objects_count": {
"type": "integer",
"description": "Overall backup objects count"
},
"packs_count": {
"type": "integer",
"description": "Overall backup download chunks count"
},
"max_objects_in_pack": {
"type": "integer",
"description": "Maximum objects in one download chunk"
},
"images_count": {
"type": "integer",
"description": "Overall images backup download chunks count"
},
"max_images_in_pack": {
"type": "integer",
"description": "Maximum images in one download chunk"
}
}
}
}
}
},
"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/backup/calculation" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"objects_count": 1,
"packs_count": 1,
"max_objects_in_pack": 1,
"images_count": 1,
"max_images_in_pack": 1
}
GET /backup/image_pack/{number}
Раздел: Резервное копирование.
Возвращает часть резервной копии изображений сотрудников.
Параметры и ответы по OpenAPI
{
"description": "Get staff images backup data chunk",
"parameters": [
{
"in": "path",
"name": "number",
"required": true,
"schema": {
"type": "integer",
"minimum": 0
}
}
],
"responses": {
"200": {
"description": "Successfully received backup data chunk",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"images": {
"type": "array",
"items": {
"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/backup/image_pack/{number}" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"images": [
{}
]
}
POST /backup/notify/{type}
Раздел: Резервное копирование.
Создает событие о состоянии резервного копирования.
Параметры и ответы по OpenAPI
{
"description": "Fire backup notification event",
"parameters": [
{
"in": "path",
"name": "type",
"description": "Notification type",
"required": true,
"schema": {
"type": "integer",
"minimum": 0,
"maximum": 3
}
}
],
"responses": {
"200": {
"description": "Successfully armed notification",
"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/backup/notify/{type}" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"success": false,
"message": "string",
"data": {}
}
POST /backup/pack
Раздел: Резервное копирование.
Импортирует данные резервной копии.
Параметры и ответы по OpenAPI
{
"description": "Import backup data",
"parameters": [
{
"in": "query",
"name": "events",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Import events data from backup"
},
{
"in": "query",
"name": "staff",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Import staff data from backup"
},
{
"in": "query",
"name": "visitors",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Import visitor data from backup"
},
{
"in": "query",
"name": "devices",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Import devices data from backup"
},
{
"in": "query",
"name": "skd_config",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Import configuration data from backup"
},
{
"in": "query",
"name": "replace",
"schema": {
"type": "boolean"
},
"description": "Replace existing objects with same id from backup"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"staff": {
"type": "array",
"items": {
"type": "object"
}
},
"cards": {
"type": "array",
"items": {
"type": "object"
}
},
"access_points": {
"type": "array",
"items": {
"type": "object"
}
},
"access_profiles": {
"type": "array",
"items": {
"type": "object"
}
},
"auth_users": {
"type": "array",
"items": {
"type": "object"
}
},
"directories": {
"type": "array",
"items": {
"type": "object"
}
},
"access_point_automations": {
"type": "array",
"items": {
"type": "object"
}
},
"staff_properties": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully imported backup data chunk",
"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/backup/pack" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"staff": [
{}
],
"cards": [
{}
],
"access_points": [
{}
],
"access_profiles": [
{}
],
"auth_users": [
{}
],
"directories": [
{}
],
"access_point_automations": [
{}
],
"staff_properties": [
{}
]
}'
Пример тела запроса
{
"staff": [
{}
],
"cards": [
{}
],
"access_points": [
{}
],
"access_profiles": [
{}
],
"auth_users": [
{}
],
"directories": [
{}
],
"access_point_automations": [
{}
],
"staff_properties": [
{}
]
}
Пример ответа
{
"success": false,
"message": "string",
"data": {}
}
GET /backup/pack/{number}
Раздел: Резервное копирование.
Возвращает часть данных резервной копии.
Параметры и ответы по OpenAPI
{
"description": "Get backup data chunk",
"parameters": [
{
"in": "query",
"name": "events",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get events backup"
},
{
"in": "query",
"name": "staff",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get staff backup"
},
{
"in": "query",
"name": "devices",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get devices backup"
},
{
"in": "query",
"name": "skd_config",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Get configuration backup"
},
{
"in": "path",
"name": "number",
"schema": {
"type": "integer",
"minimum": 0
},
"required": true
}
],
"responses": {
"200": {
"description": "Successfully get backup",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"staff": {
"type": "array",
"items": {
"type": "object"
}
},
"cards": {
"type": "array",
"items": {
"type": "object"
}
},
"access_points": {
"type": "array",
"items": {
"type": "object"
}
},
"access_profiles": {
"type": "array",
"items": {
"type": "object"
}
},
"auth_users": {
"type": "array",
"items": {
"type": "object"
}
},
"directories": {
"type": "array",
"items": {
"type": "object"
}
},
"access_point_automations": {
"type": "array",
"items": {
"type": "object"
}
},
"staff_properties": {
"type": "array",
"items": {
"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/backup/pack/{number}" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"staff": [
{}
],
"cards": [
{}
],
"access_points": [
{}
],
"access_profiles": [
{}
],
"auth_users": [
{}
],
"directories": [
{}
],
"access_point_automations": [
{}
],
"staff_properties": [
{}
]
}
GET /backup/pack_size
Раздел: Резервное копирование.
Возвращает размер пакета резервной копии в объектах.
Параметры и ответы по OpenAPI
{
"description": "Get backup pack size in terms of objects",
"responses": {
"200": {
"description": "Successfully get backup pack size",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"common",
"images"
],
"properties": {
"common": {
"type": "integer",
"minimum": 200
},
"images": {
"type": "integer",
"minimum": 20
}
}
}
}
}
},
"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/backup/pack_size" \
-H "Authorization: Bearer <token>"
Пример ответа
{
"common": 200,
"images": 20
}
GET /backup/redis-dump/{dbs}
Раздел: Резервное копирование.
Создает резервную копию JSON данных Redis.
Параметры и ответы по OpenAPI
{
"summary": "Dump Redis data",
"description": "Создает резервную копию JSON данных Redis.",
"parameters": [
{
"in": "path",
"name": "dbs",
"description": "массив номеров БД",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
},
"headers": {
"Content-Type": {
"description": "The content type of the backup file",
"schema": {
"type": "string"
}
},
"Content-Disposition": {
"description": "The content disposition of the backup file",
"schema": {
"type": "string"
}
}
}
}
}
}
Примеры по OpenAPI
Сформированы по схеме контроллера; значения полей необходимо заменить.
Пример запроса
curl -k -X GET "https://{IP_контроллера}/api/v1/backup/redis-dump/{dbs}" \
-H "Authorization: Bearer <token>"
Пример ответа
"string"
POST /backup/redis-restore
Раздел: Резервное копирование.
Создает данные или выполняет действие ресурса /backup/redis-restore в разделе «Резервное копирование».
Параметры и ответы по OpenAPI
{
"summary": "Restore Redis data",
"description": "Restores Redis data from a JSON backup file.",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"required": [
"backup"
],
"properties": {
"backup": {
"type": "string",
"format": "binary",
"description": "The JSON backup file"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Invalid JSON backup file"
}
}
}
Примеры по OpenAPI
Сформированы по схеме контроллера; значения полей необходимо заменить.
Пример запроса
curl -k -X POST "https://{IP_контроллера}/api/v1/backup/redis-restore" \
-H "Authorization: Bearer <token>" \
--form 'backup=@/path/to/backup;type=application/octet-stream'