Dynamic data model API overview (on the example of class 'abc/mnesia')
- Overview
- Requests
- Creating a new entity in a dynamic class collection
- Getting a list of entities from a dynamic class collection
- Retrieving entity data from a dynamic class collection
- Modifying entity data from a dynamic class collection
- Deleting an entity from a dynamic class collection
- Clears the collection of a dynamic class
- Searching for an entity identifier in a dynamic class collection
- Rantime customization of a dynamic class collection collection
- Table of Contents (subsidiary resources)
- References
Overview
Allows you to perform CRUD operations on a collection of a dynamic class.
Transactions are also available via Websocket-API (capability `rest`).
Operations with attachment files are supported.
If you specify a path with a slash at the end, the GET operation produces a list of available child-level partitions/collections.
Requests
HTTP verb | Endpoint | Description |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Searching for an entity identifier in a dynamic class collection |
|
|
Rantime customization of a dynamic class collection collection |
Creating a new entity in a dynamic class collection
Request
Field Description: are determined based on the class property settings (class entity)
POST /rest/v1/model/abc/mnesia HTTP/1.1
Content-Type: application/json; charset=utf-8
are determined based on the class property settings (class entity)
Response
Field Description: are determined based on the class property settings (class entity)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "6f7d27df-017b-ab81-77e7-7cd30a921f58",
"patts":[],
"pbool": false,
"penum": "i1",
"pint": 8640000,
"plong": 1630924984167,
"pstr": "asdfasdfasdf"
}
Getting a list of entities from a dynamic class collection
Request
Name | Type | Description |
---|---|---|
|
|
Element Filter. Represents a logical expression in Polish notation. Defined as a json array representing the Polish notation of a complex logical expression. The first element of any array is the name of the function (string), the second and subsequent elements of the list are the arguments of the function, each of which in turn can be an expression (json-array). Examples:
|
|
|
The sort order of the resources in the list. Applies a sequence of fields, where each field has a sort direction defined, and applies the next field when values match. Examples:
|
|
|
List of fields to output. Available fields for output: (is configured in the options of a particular class - field `max_mask`). It is allowed to specify composite fields either as a whole or with the nested options of interest indicated by a dot, regardless of the value of the parameter flat. Example:
|
|
|
Offset in the list of resources to be issued.
The sequence number from zero in the filtered ( Example:
|
|
|
The maximum number of resources to be output from a filtered ( Example:
|
|
|
Flag indicating the necessity to output only the number of items that fall under the filter conditions. |
|
|
For collections like 'history' and 'transactionlog', a mandatory parameter specifying the time interval for data sampling. In this case, to refer to the endpoint of a particular element of such collections, it is necessary to use the date as an intermediate path segment. |
|
|
Aggregate value descriptor. The key is an arbitrary field name, the value is an aggregating expression (where the main function is aggregating). Used in conjunction with the parameter 'groupby'. Example:
|
|
|
Descriptor of grouping fields or expressions. The key is an arbitrary field name, the value is the name of a real class field, or an expression similar to filter, but not necessarily boolean. Used in conjunction with the parameter 'aggr'. Example:
|
Function (and synonyms) | Number of arguments | Description |
---|---|---|
|
|
Access any entity field, including the deep path in complex object and list fields. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function (and synonyms) | Number of arguments | Description |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GET /rest/v1/model/abc/mnesia?offset=0&limit=2 HTTP/1.1
Response
Field Description: are determined based on the class property settings (class entity)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
[
{
"id": "6f7d27df-017b-ab81-77e7-7cd30a921f58",
"patt":{
"hasha": "md5;A95C530A7AF5F492A74499E70578D150",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patt/content",
"mtime": "2021-09-07T10:47:06Z",
"name": "content",
"size": 12
},
"patts":[
{
"hasha": "md5;2B00042F7481C7B056C4B410D28F33CF",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patts/app.mp3",
"mtime": "2021-09-07T10:47:47Z",
"name": "app.mp3",
"size": 538925
},
{
"hasha": "md5;236C8E5A21AF6E369045F004B1CAEA1C",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patts/test.json",
"mtime": "2021-09-07T10:47:47Z",
"name": "test.json",
"size": 14
}
],
"pbool": false,
"penum": "i1",
"pint": 8640000,
"plong": 1630924984167,
"pstr": "asdfasdfasdf"
}
]
Retrieving entity data from a dynamic class collection
Request
Name | Type | Description |
---|---|---|
|
|
A list of fields to output. |
|
|
Conversion to flat form of composite fields. |
GET /rest/v1/model/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58 HTTP/1.1
Response
Field Description: are determined based on the class property settings (class entity)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "6f7d27df-017b-ab81-77e7-7cd30a921f58",
"patt":{
"hasha": "md5;A95C530A7AF5F492A74499E70578D150",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patt/content",
"mtime": "2021-09-07T10:47:06Z",
"name": "content",
"size": 12
},
"patts":[
{
"hasha": "md5;2B00042F7481C7B056C4B410D28F33CF",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patts/app.mp3",
"mtime": "2021-09-07T10:47:47Z",
"name": "app.mp3",
"size": 538925
},
{
"hasha": "md5;236C8E5A21AF6E369045F004B1CAEA1C",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patts/test.json",
"mtime": "2021-09-07T10:47:47Z",
"name": "test.json",
"size": 14
}
],
"pbool": false,
"penum": "i1",
"pint": 8640000,
"plong": 1630924984167,
"pstr": "asdfasdfasdf"
}
Modifying entity data from a dynamic class collection
The operation performs a preliminary read and then merges the current object with the passed value.
-
A value of 'null' will reset the field to zero.
-
Values of fields with type 'any' instead of substitution are mixed in depth by the number of levels specified in the options of the corresponding field.
-
The values of all fields that have the 'multi' option (arrays) can be added to the end of the current values if the parameter is passed in the query 'append' (append=true).
-
Entities with a 'runtime' storage type and a configured auto-delete mode can extend their lifetime on refresh.
Fields prohibited for modification: id
Request
Field Description: are determined based on the class property settings (class entity)
PATCH /rest/v1/model/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58 HTTP/1.1
Content-Type: application/json; charset=utf-8
are determined based on the class property settings (class entity)
Response
Field Description: are determined based on the class property settings (class entity)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "6f7d27df-017b-ab81-77e7-7cd30a921f58",
"patt":{
"hasha": "md5;A95C530A7AF5F492A74499E70578D150",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patt/content",
"mtime": "2021-09-07T10:47:06Z",
"name": "content",
"size": 12
},
"patts":[
{
"hasha": "md5;2B00042F7481C7B056C4B410D28F33CF",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patts/app.mp3",
"mtime": "2021-09-07T10:47:47Z",
"name": "app.mp3",
"size": 538925
},
{
"hasha": "md5;236C8E5A21AF6E369045F004B1CAEA1C",
"link": "fs://1a2325b6-017b-abab-bba4-7cd30a921f58/fstest_attaches/test.rootdomain.ru/abc/mnesia/6f7d27df-017b-ab81-77e7-7cd30a921f58/patts/test.json",
"mtime": "2021-09-07T10:47:47Z",
"name": "test.json",
"size": 14
}
],
"pbool": true,
"penum": "i2",
"pint": 8640000,
"plong": 1630924984167,
"pstr": "Other value"
}
Deleting an entity from a dynamic class collection
Searching for an entity identifier in a dynamic class collection
Searches the resource for the specified key, returns the identifier(s) to build the endpoint.
Key fields to search for: (identifier and fields configured in the options of a particular class - field `lookup_properties`)
Request
LOOKUP /rest/v1/model/<classname> HTTP/1.1
Content-Type: application/json; charset=utf-8
"asdfasdfasdf"
Response
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
[
"6f7d27df-017b-ab81-77e7-7cd30a921f58"
]
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
{
"error_code": 1404,
"error_message": "Lookup failed"
}
Rantime customization of a dynamic class collection collection
Performs rantime tuning of the collection by changing the behavior.
{ "cmd": ..., ... }
Types of commands ('cmd'):
-
suspend_notification
- temporarily suspends sending notifications about class entities modifications (valid until the microservice is canceled or restarted). This mode can be used for large-scale modification operations with hundreds or thousands of subscribers. -
resume_notification
- resumes previously suspended notification sending. Simultaneously can send (by default) or not send a 'reload' operation event to all current subscribers (optional additional parameter) 'send_reload').