Классы/коллекции (classes)

Запросы

HTTP verb Endpoint Описание

POST

/rest/v1/design/classes

Создание нового класса

GET

/rest/v1/design/classes

Получение списка классов (метаданные коллекции)

GET

/rest/v1/design/classes/<id>

Получение данных класса (метаданные коллекции)

PATCH

/rest/v1/design/classes/<id>

Изменение данных класса (метаданные коллекции)

DELETE

/rest/v1/design/classes/<id>

Удаление класса

LOOKUP

/rest/v1/design/classes

Поиск идентификатора класса


Создание нового класса

Запрос

Описание полей: class entity

Пример запроса
POST /rest/v1/design/classes HTTP/1.1
Content-Type: application/json; charset=utf-8

class entity

Ответ

Описание полей: class entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "5580bb7a-0178-3fc1-67fc-7cd30a921f58",
  "classname": "abc/mnesia",
  "name": "",
  "description": "",
  "parent_id": "00000000-0000-0000-0000-000000000000",
  "storage_mode": "runtime",
  "integrity_mode": "sync_fast_notify",
  "cache_mode": "temp",
  "properties": [
    {
      "caption": "NAME",
      "data_type": "string",
      "name": "name"
    },
    {
      "caption": "VALUE",
      "data_type": "any",
      "name": "value"
    },
    {
      "caption": "TS",
      "data_type": "long",
      "name": "ts"
    },
    {
      "caption": "TTL",
      "data_type": "int",
      "name": "ttl"
    }
  ],
  "opts": {
    "title": "",
    "comment": "",
    "dms_group": {},
    "cache_limit": 1000,
    "cache_sec": 600,
    "check_required_fill_defaults": true,
    "expires_mode": "create",
    "expires_ts_property": "ts",
    "expires_ttl_property": "ttl",
    "lookup_properties": [
      "ttl",
      "name"
    ],
    "max_limit": 100,
    "max_mask": [],
    "max_size": 1000000,
    "notify_transactions": false,
    "partition_count": 2,
    "partition_interval": "month",
    "partition_property": "",
    "replication_factor": 2,
    "storage_instance": "",
    "filestorage_instance": "fstest"
  },
  "ext": {
    "ct": "2021-04-02T19:33:49.46Z",
    "lwt": "2021-09-03T12:57:17.48Z"
  }
}

Получение списка классов (метаданные коллекции)

Запрос

Table 1. Параметры запроса
Имя Тип Описание

filter

object

Фильтр по значениям полей.

mask

str

Список полей для вывода. Доступные поля для выдачи: id, classname, parent_id, name, description, properties, storage_mode, integrity_mode, cache_mode, opts.title, opts.comment, ext.lwt, ext.ct.

offset

int

Смещение в списке ресурсов, подлежащих выдаче.

limit

int

Максимальное количество ресурсов в списке.

order

array<object|str>

Порядок сортировки ресурсов в списке.

flat

bool

Преобразование в плоский вид составных полей.

Пример запроса
GET /rest/v1/design/classes?offset=0&limit=10 HTTP/1.1

Ответ

Описание полей: class entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "1830c247-017b-bf98-5d37-7cd30a921f58",
    "classname": "base",
    "name": "",
    "description": "",
    "parent_id": "00000000-0000-0000-0000-000000000000",
    "storage_mode": "abstract",
    "integrity_mode": "sync_fast_read",
    "cache_mode": "none",
    "properties": [
      {
        "caption": "INT",
        "data_type": "integer",
        "name": "pint",
        "required": true
      },
      {
        "caption": "STR",
        "data_type": "string",
        "name": "pstr"
      },
      {
        "caption": "DT",
        "data_type": "datetime",
        "name": "pdt",
        "required": true
      },
      {
        "caption": "BOOL",
        "data_type": "boolean",
        "default": false,
        "name": "pbool"
      },
      {
        "caption": "TIME",
        "data_type": "time",
        "name": "ptime"
      },
      {
        "caption": "DATE",
        "data_type": "date",
        "name": "pdate"
      },
      {
        "caption": "INTARR",
        "data_type": "integer",
        "multi": true,
        "name": "pintarr"
      },
      {
        "caption": "TIME",
        "data_type": "time",
        "name": "ptime"
      },
      {
        "caption": "FLOAT",
        "data_type": "float",
        "name": "pfloat"
      },
      {
        "caption": "ANY",
        "data_type": "any",
        "name": "pany"
      },
      {
        "caption": "ENUM",
        "data_type": "enum",
        "default": "i1",
        "items": [
          "i1",
          "i2",
          "i3"
        ],
        "name": "penum"
      },
      {
        "caption": "UUID",
        "data_type": "uuid",
        "name": "puuid"
      },
      {
        "caption": "LONG",
        "data_type": "long",
        "default": "1234567890",
        "name": "plong"
      },
      {
        "caption": "ATT",
        "data_type": "attachment",
        "name": "patt"
      },
      {
        "caption": "ATTS",
        "data_type": "attachment",
        "multi": true,
        "name": "patts"
      }
    ],
    "opts": {
      "title": "",
      "comment": "This is abstract base class",
      "dms_group": {},
      "cache_limit": 1000,
      "cache_sec": 600,
      "check_required_fill_defaults": true,
      "expires_mode": "none",
      "expires_ts_property": "",
      "expires_ttl_property": "",
      "lookup_properties": [],
      "max_limit": 100,
      "max_mask": [],
      "max_size": 10000,
      "notify_transactions": false,
      "partition_count": 2,
      "partition_interval": "month",
      "partition_property": "",
      "replication_factor": 2,
      "storage_instance": "auto",
      "filestorage_instance": "auto"
    },
    "ext": {
      "ct": "2021-04-05T05:26:13.44Z",
      "lwt": "2021-04-05T05:26:13.44Z"
    }
  },
  {
    "id": "6680bb7a-0178-3fc1-67fc-7cd30a921f58",
    "classname": "abc/asd",
    "name": "",
    "description": "",
    "parent_id": "1830c247-017b-bf98-5d37-7cd30a921f58",
    "storage_mode": "category",
    "integrity_mode": "sync_fast_read",
    "cache_mode": "none",
    "properties": [],
    "opts": {
      "title": "",
      "comment": "This is child class of base",
      "dms_group": {},
      "cache_limit": 1000,
      "cache_sec": 600,
      "check_required_fill_defaults": true,
      "expires_mode": "none",
      "expires_ts_property": "",
      "expires_ttl_property": "",
      "lookup_properties": [
        "pdt",
        "pint"
      ],
      "max_limit": 100,
      "max_mask": [],
      "max_size": 10000,
      "notify_transactions": false,
      "partition_count": 2,
      "partition_interval": "month",
      "partition_property": "",
      "replication_factor": 2,
      "storage_instance": "a",
      "filestorage_instance": "auto"
    },
    "ext": {
      "ct": "2021-04-05T07:57:02.22Z",
      "lwt": "2021-04-05T08:02:13.14Z"
    }
  },
  {
    "id": "5580bb7a-0178-3fc1-67fc-7cd30a921f58",
    "classname": "abc/mnesia",
    "name": "",
    "description": "",
    "parent_id": "00000000-0000-0000-0000-000000000000",
    "storage_mode": "runtime",
    "integrity_mode": "sync_fast_notify",
    "cache_mode": "temp",
    "properties": [
      {
        "caption": "NAME",
        "data_type": "string",
        "name": "name"
      },
      {
        "caption": "VALUE",
        "data_type": "any",
        "name": "value"
      },
      {
        "caption": "TS",
        "data_type": "long",
        "name": "ts"
      },
      {
        "caption": "TTL",
        "data_type": "int",
        "name": "ttl"
      }
    ],
    "opts": {
      "title": "",
      "comment": "",
      "dms_group": {},
      "cache_limit": 1000,
      "cache_sec": 600,
      "check_required_fill_defaults": true,
      "expires_mode": "create",
      "expires_ts_property": "ts",
      "expires_ttl_property": "ttl",
      "lookup_properties": [
        "ttl",
        "name"
      ],
      "max_limit": 100,
      "max_mask": [],
      "max_size": 1000000,
      "notify_transactions": false,
      "partition_count": 2,
      "partition_interval": "month",
      "partition_property": "",
      "replication_factor": 2,
      "storage_instance": "",
      "filestorage_instance": "fstest"
    },
    "ext": {
      "ct": "2021-04-02T19:33:49.46Z",
      "lwt": "2021-09-03T12:57:17.48Z"
    }
  },
  {
    "id": "7780bb7a-0178-3fc1-67fc-7cd30a921f58",
    "classname": "abc/fgh",
    "name": "",
    "description": "",
    "parent_id": "6680bb7a-0178-3fc1-67fc-7cd30a921f58",
    "storage_mode": "history",
    "integrity_mode": "sync_fast_read",
    "cache_mode": "none",
    "properties": [
      {
        "caption": "INT",
        "data_type": "integer",
        "name": "pint",
        "required": false
      },
      {
        "caption": "STR",
        "data_type": "string",
        "name": "pstr",
        "default": ""
      },
      {
        "caption": "DT",
        "data_type": "datetime",
        "name": "pdt",
        "required": false
      },
      {
        "caption": "BOOL",
        "data_type": "boolean",
        "default": true,
        "name": "pbool"
      }
    ],
    "opts": {
      "title": "",
      "comment": "This is child class of abc/asd, overriding some properties",
      "dms_group": {},
      "cache_limit": 1000,
      "cache_sec": 600,
      "check_required_fill_defaults": true,
      "expires_mode": "none",
      "expires_ts_property": "",
      "expires_ttl_property": "",
      "filestorage_instance": "",
      "lookup_properties": [
        "pdt",
        "pint"
      ],
      "max_limit": 100,
      "max_mask": [],
      "max_size": 10000,
      "notify_transactions": false,
      "partition_count": 2,
      "partition_interval": "month",
      "partition_property": "pdt",
      "replication_factor": 2,
      "storage_instance": "a",
      "filestorage_instance": "auto"
    },
    "ext": {
      "ct": "2021-04-05T11:24:54.75Z",
      "lwt": "2021-04-05T11:24:54.75Z"
    }
  },
  {
    "id": "8780bb7a-0178-3fc1-67fc-7cd30a921f58",
    "classname": "abc/kafka",
    "name": "",
    "description": "",
    "parent_id": "00000000-0000-0000-0000-000000000000",
    "storage_mode": "transactionlog",
    "integrity_mode": "sync_fast_read",
    "cache_mode": "none",
    "properties": [
      {
        "data_type": "uuid",
        "name": "id2"
      },
      {
        "data_type": "string",
        "name": "pstr"
      },
      {
        "data_type": "integer",
        "name": "pint"
      },
      {
        "data_type": "datetime",
        "name": "pdt"
      }
    ],
    "opts": {
      "title": "",
      "comment": "transactionlog",
      "dms_group": {},
      "cache_limit": 1000,
      "cache_sec": 600,
      "check_required_fill_defaults": true,
      "expires_mode": "none",
      "expires_ts_property": "",
      "expires_ttl_property": "",
      "filestorage_instance": "",
      "lookup_properties": [
        "pstr",
        "pint"
      ],
      "max_limit": 100,
      "max_mask": [],
      "max_size": 10000,
      "notify_transactions": false,
      "partition_count": 2,
      "partition_interval": "month",
      "partition_property": "",
      "replication_factor": 2,
      "storage_instance": "b",
      "filestorage_instance": "mys3"
    },
    "ext": {
      "ct": "2021-04-21T19:45:47.55Z",
      "lwt": "2021-05-20T07:19:19.77Z"
    }
  }
]

Получение данных класса (метаданные коллекции)

Запрос

Table 2. Параметры запроса
Имя Тип Описание

mask

str

Список полей для вывода.

flat

bool

Преобразование в плоский вид составных полей.

Пример запроса
GET /rest/v1/design/classes/5580bb7a-0178-3fc1-67fc-7cd30a921f58 HTTP/1.1

Ответ

Описание полей: class entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "5580bb7a-0178-3fc1-67fc-7cd30a921f58",
  "classname": "abc/mnesia",
  "name": "",
  "description": "",
  "parent_id": "00000000-0000-0000-0000-000000000000",
  "storage_mode": "runtime",
  "integrity_mode": "sync_fast_notify",
  "cache_mode": "temp",
  "properties": [
    {
      "caption": "NAME",
      "data_type": "string",
      "name": "name"
    },
    {
      "caption": "VALUE",
      "data_type": "any",
      "name": "value"
    },
    {
      "caption": "TS",
      "data_type": "long",
      "name": "ts"
    },
    {
      "caption": "TTL",
      "data_type": "int",
      "name": "ttl"
    }
  ],
  "opts": {
    "title": "",
    "comment": "",
    "dms_group": {},
    "cache_limit": 1000,
    "cache_sec": 600,
    "check_required_fill_defaults": true,
    "expires_mode": "create",
    "expires_ts_property": "ts",
    "expires_ttl_property": "ttl",
    "lookup_properties": [
      "ttl",
      "name"
    ],
    "max_limit": 100,
    "max_mask": [],
    "max_size": 1000000,
    "notify_transactions": false,
    "partition_count": 2,
    "partition_interval": "month",
    "partition_property": "",
    "replication_factor": 2,
    "storage_instance": "",
    "filestorage_instance": "fstest"
  },
  "ext": {
    "ct": "2021-04-02T19:33:49.46Z",
    "lwt": "2021-09-03T12:57:17.48Z"
  }
}

Изменение данных класса (метаданные коллекции)

Поля запрещенные для изменения: id

Запрос

Описание полей: class entity

Пример запроса
PATCH /rest/v1/design/classes/5580bb7a-0178-3fc1-67fc-7cd30a921f58 HTTP/1.1
Content-Type: application/json; charset=utf-8

class entity

Ответ

Описание полей: class entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "5580bb7a-0178-3fc1-67fc-7cd30a921f58",
  "classname": "abc/mnesia",
  "name": "",
  "description": "",
  "parent_id": "00000000-0000-0000-0000-000000000000",
  "storage_mode": "runtime",
  "integrity_mode": "sync_fast_notify",
  "cache_mode": "temp",
  "properties": [
    {
      "caption": "NAME",
      "data_type": "string",
      "name": "name",
      "required": true
    },
    {
      "caption": "VALUE",
      "data_type": "any",
      "name": "value"
    },
    {
      "caption": "DT",
      "data_type": "datetime",
      "name": "dt"
    },
    {
      "caption": "TS",
      "data_type": "long",
      "name": "ts"
    },
    {
      "caption": "TTL",
      "data_type": "int",
      "name": "ttl"
    }
  ],
  "opts": {
    "title": "",
    "comment": "This is auto-ttl class",
    "dms_group": {},
    "cache_limit": 1000,
    "cache_sec": 600,
    "check_required_fill_defaults": true,
    "expires_mode": "create",
    "expires_ts_property": "ts",
    "expires_ttl_property": "ttl",
    "lookup_properties": [
      "ttl",
      "name"
    ],
    "max_limit": 100,
    "max_mask": [],
    "max_size": 1000000,
    "notify_transactions": false,
    "partition_count": 2,
    "partition_interval": "month",
    "partition_property": "",
    "replication_factor": 2,
    "storage_instance": "",
    "filestorage_instance": "fstest"
  },
  "ext": {
    "ct": "2021-04-02T19:33:49.46Z",
    "lwt": "2021-09-03T12:57:17.48Z"
  }
}

Удаление класса

Запрос

Пример запроса
DELETE /rest/v1/design/classes/5580bb7a-0178-3fc1-67fc-7cd30a921f58 HTTP/1.1

Ответ

Пример ответа
HTTP/1.1 204 No Content

Поиск идентификатора класса

Производит поиск ресурса по указанному ключу, возвращает идентификатор(ы) для построения endpoint.

Ключевые поля для поиска: id, classname

Запрос

Пример запроса
LOOKUP /rest/v1/design/classes HTTP/1.1
Content-Type: application/json; charset=utf-8

"abc/mnesia"

Ответ

Пример успешного ответа
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

[
  "5580bb7a-0178-3fc1-67fc-7cd30a921f58"
]
Пример неуспешного ответа
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{
  "error_code": 1404,
  "error_message": "Lookup failed"
}