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

Карты API 1.7.0

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

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

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

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

МетодПуть
GET/cards
POST/cards
GET/cards/count
GET/cards/ext_privileges
GET/cards/search
GET/cards/{code}
PUT/cards/{code}
DELETE/cards/{code}

GET /cards

Раздел: Карты.

Возвращает список карт.

Параметры и ответы по OpenAPI
{
"description": "Returns list of cards",
"parameters": [
{
"in": "query",
"name": "page",
"description": "Cards page id to load",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
},
{
"in": "query",
"name": "page_size",
"description": "Maximum number of cards in page",
"required": true,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 200
}
}
],
"responses": {
"200": {
"description": "Successfully returned specified page of registered cards",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"code",
"privilege",
"disposable",
"expire"
],
"properties": {
"code": {
"type": "string",
"minLength": 1,
"pattern": "^[1-9]\\d*$"
},
"privilege": {
"type": "integer"
},
"disposable": {
"type": "boolean"
},
"expire": {
"type": "integer",
"format": "int64",
"description": "Card expiration UNIX timestamp in milliseconds"
},
"user_uuid": {
"type": "string"
},
"comment": {
"type": "string"
},
"ext_privileges": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SET_AP_STATE",
"SET_ON_GUARD",
"UNSET_ON_GUARD",
"START_AUTOMATION",
"CONFIRM_ACCESS",
"EASY_ACCESS",
"SKIP_ZONES_CONTROL"
]
}
}
}
}
}
}
}
},
"400": {
"description": "Invalid request",
"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"
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

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

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

[
{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}
]

POST /cards

Раздел: Карты.

Добавляет карту в систему.

Параметры и ответы по OpenAPI
{
"description": "Add new card to system",
"requestBody": {
"description": "Creates new card in database",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"code",
"privilege",
"disposable",
"expire"
],
"properties": {
"code": {
"type": "string",
"minLength": 1,
"pattern": "^[1-9]\\d*$"
},
"privilege": {
"type": "integer"
},
"disposable": {
"type": "boolean"
},
"expire": {
"type": "integer",
"format": "int64",
"description": "Card expiration UNIX timestamp in milliseconds"
},
"user_uuid": {
"type": "string"
},
"comment": {
"type": "string"
},
"ext_privileges": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SET_AP_STATE",
"SET_ON_GUARD",
"UNSET_ON_GUARD",
"START_AUTOMATION",
"CONFIRM_ACCESS",
"EASY_ACCESS",
"SKIP_ZONES_CONTROL"
]
}
}
}
}
}
}
},
"responses": {
"201": {
"description": "Card has been successfully added",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"409": {
"description": "Card already exists",
"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"
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

curl -k -X POST "https://{IP_контроллера}/api/v1/cards" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}'

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

{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}

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

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

GET /cards/count

Раздел: Карты.

Возвращает общее количество карт.

Параметры и ответы по OpenAPI
{
"description": "Get cards overall count",
"responses": {
"200": {
"description": "Successfully got cards overall count",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"count"
],
"properties": {
"count": {
"type": "integer"
}
}
}
}
}
},
"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"
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

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

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

{
"count": 1
}

GET /cards/ext_privileges

Раздел: Карты.

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

Параметры и ответы по OpenAPI
{
"description": "Get cards extended privileges description",
"responses": {
"200": {
"description": "Successfully got cards ext privileges description",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"description"
],
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
}
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

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

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

[
{
"name": "string",
"description": "string"
}
]

Раздел: Карты.

Ищет карты по части кода.

Параметры и ответы по OpenAPI
{
"description": "Search for cards by part of code as substring of code string",
"parameters": [
{
"in": "query",
"name": "search_query",
"required": true,
"description": "Card code search query",
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "page",
"required": false,
"description": "Search results maximum page size",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 50
}
},
{
"in": "query",
"name": "cursor",
"required": false,
"description": "Cursor to proceed search from, if skipped, starts search from beginning and calculates all results count",
"schema": {
"type": "integer",
"minimum": 0
}
},
{
"in": "query",
"name": "page_size",
"required": false,
"description": "Page size of violation events",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully returned found cards page",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"page",
"cursor",
"cards"
],
"properties": {
"count": {
"type": "integer",
"minimum": 0,
"description": "Overall search results count, calculated only when cursor was not specified in requst"
},
"page": {
"type": "integer",
"minimum": 1,
"maximum": 50
},
"cursor": {
"type": "integer",
"minimum": 0,
"description": "Next element to search from to get next search page, or 0 if search stopped"
},
"cards": {
"type": "array",
"items": {
"type": "object",
"required": [
"code",
"privilege",
"disposable",
"expire"
],
"properties": {
"code": {
"type": "string",
"minLength": 1,
"pattern": "^[1-9]\\d*$"
},
"privilege": {
"type": "integer"
},
"disposable": {
"type": "boolean"
},
"expire": {
"type": "integer",
"format": "int64",
"description": "Card expiration UNIX timestamp in milliseconds"
},
"user_uuid": {
"type": "string"
},
"comment": {
"type": "string"
},
"ext_privileges": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SET_AP_STATE",
"SET_ON_GUARD",
"UNSET_ON_GUARD",
"START_AUTOMATION",
"CONFIRM_ACCESS",
"EASY_ACCESS",
"SKIP_ZONES_CONTROL"
]
}
}
}
}
}
}
}
}
}
},
"400": {
"description": "Invalid request",
"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 GET "https://{IP_контроллера}/api/v1/cards/search?search_query=<search_query>" \
-H "Authorization: Bearer <token>"

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

{
"count": 1,
"page": 1,
"cursor": 1,
"cards": [
{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}
]
}

GET /cards/{code}

Раздел: Карты.

Возвращает данные указанной карты.

Параметры и ответы по OpenAPI
{
"description": "Get specified card data",
"parameters": [
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully got card with specified code",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"code",
"privilege",
"disposable",
"expire"
],
"properties": {
"code": {
"type": "string",
"minLength": 1,
"pattern": "^[1-9]\\d*$"
},
"privilege": {
"type": "integer"
},
"disposable": {
"type": "boolean"
},
"expire": {
"type": "integer",
"format": "int64",
"description": "Card expiration UNIX timestamp in milliseconds"
},
"user_uuid": {
"type": "string"
},
"comment": {
"type": "string"
},
"ext_privileges": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SET_AP_STATE",
"SET_ON_GUARD",
"UNSET_ON_GUARD",
"START_AUTOMATION",
"CONFIRM_ACCESS",
"EASY_ACCESS",
"SKIP_ZONES_CONTROL"
]
}
}
}
}
}
}
},
"400": {
"description": "Bad request (card code is not valid integer)",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"404": {
"description": "Specified card 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"
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

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

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

{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}

PUT /cards/{code}

Раздел: Карты.

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

Параметры и ответы по OpenAPI
{
"description": "Modify specified card data",
"parameters": [
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^[1-9]\\d*$"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"code",
"privilege",
"disposable",
"expire"
],
"properties": {
"code": {
"type": "string",
"minLength": 1,
"pattern": "^[1-9]\\d*$"
},
"privilege": {
"type": "integer"
},
"disposable": {
"type": "boolean"
},
"expire": {
"type": "integer",
"format": "int64",
"description": "Card expiration UNIX timestamp in milliseconds"
},
"user_uuid": {
"type": "string"
},
"comment": {
"type": "string"
},
"ext_privileges": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SET_AP_STATE",
"SET_ON_GUARD",
"UNSET_ON_GUARD",
"START_AUTOMATION",
"CONFIRM_ACCESS",
"EASY_ACCESS",
"SKIP_ZONES_CONTROL"
]
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully modified card data",
"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"
}
}
}
}
}
},
"404": {
"description": "Specified card 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"
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

curl -k -X PUT "https://{IP_контроллера}/api/v1/cards/{code}" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-raw '{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}'

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

{
"code": "string",
"privilege": 1,
"disposable": true,
"expire": 1,
"user_uuid": "string",
"comment": "string",
"ext_privileges": [
"SET_AP_STATE"
]
}

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

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

DELETE /cards/{code}

Раздел: Карты.

Удаляет карту.

Параметры и ответы по OpenAPI
{
"description": "Delete card",
"parameters": [
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^[1-9]\\d*$"
}
}
],
"responses": {
"200": {
"description": "Successfully deleted card",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Invalid card code",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean",
"example": false
},
"message": {
"type": "string"
},
"data": {
"type": "object"
}
}
}
}
}
},
"404": {
"description": "Specified card 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"
}
}
}
}
}
}
},
"deprecated": true
}

Примеры по OpenAPI

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

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

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

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

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