Logo
Logo
Description a P I.en

Description of the API #

Description of the API ———— The

interaction between the client and the server in Abris is carried out using the JSON-RPC 2.0 protocol, however, the request format is slightly different, namely the absence of the “id” property, both in the request and in the response.

Requests sent to the server must contain two required properties:

  • method - a string with the name of the method being called;

  • params - an array of data that should be passed to the method as parameters.

The “id” property used to match the request and response is not required.

The responses received from the server must contain the following properties:

  • result - the data returned by the method. If an error occurs during method execution, this property must be set to “null”;

– errorerror code if an error occurred during the execution of the method, otherwise null.

The id property - the same value as in the request to whichbelongs this response- is missing.

Request for metadata #

  1. Request for metadata is performed using the method (field “method”) getAllModelMetadata.

The following are specified as parameters (the “params” field):

`` `{.json} [{

}]

If the request was successful, the server will send the following data in response:

  • error - an error code with the value" null “;

  • jsonrpc - protocol version with value “2.0”;

  • result - data returned by the method:

    • pages - page layout into blocks and subblocks (if any);

    • projections - directly a list of projections in the system available to the user, as well as their metadata (for example, the fields they contain and their type).

  • usename - username if authorization was performed.

Query of table data #

  1. A query to get table data is carried out using themethod getTableDataPredicate(field “method”).

The following are specified as parameters (the “params” field):

  • entityName - table name

  • schemaName - schema name

  • aggregate - block for setting aggregating functions

  • limit - sample size

  • offset - record number from which to start selection

  • primaryKey - field name - primary key

  • currentKey - the current value of the primary key. It can be omitted, but if it is set, the offset parameterignored and the will beexact page of data will be returned, on which there is a record with the specified value

  • join - tables that need to be joined to theresults query. For each table it is indicated:

    • schema - schema name
    • entity - table name
    • key - field of the main table, by which we connect
    • entityKey - field of the joined table
    • table_alias is an alias that is assigned to the joined table
    • parent_table_alias - alias of the main table
    • virtual - flag if a virtualfieldattached table is- fields - fields to load. For each field, the following is determined:
    • table_alias is the alias of the table that thisbelongs to field
    • subfields - fields of the table associated with this field, which should be displayed instead of it (if the field is a foreign key)
    • subfields_table_alias - the corresponding subfieldsaliases table
    • subfields_navigate_alias - base table alias
    • subfields_key - base table key
  • predicate - predicate

    • operands - operands
    • levelup - used for multilevel conditions
    • field - field
    • path - ignored
    • op - operator (https://abris.site:8090/abris-lab/abris/wikis/tasks/Filtering-the-displayed-data)
    • value is the second operand
    • search_in_key - search for data also in the key
    • table_alias is the alias of the table in which the field is located
    • strict - true if the operands are

ANDed`` {.json} [ { "entityName": "ticket_flights", "schemaName": "bookings", "predicate": { "strict": true, "operands": [ { "levelup": false, "operand": { "field": "fare_conditions", "path": [ "fare_conditions" ], "op": "EQ", "value": "Economy", "search_in_key": false, "table_alias": "t" } }, { "levelup": false, "operand": { "field": "amount", "path": [ "amount" ], "op": "G", "value": "25000", "search_in_key": false, "table_alias": "t" } } ] }, "aggregate": [ { "func": "avg", "field": "amount" } ], "limit": "10", "offset": 20, "primaryKey": "ticket_no", "currentKey": "", "fields": { "ticket_no": { "table_alias": "t", "subfields": null, "hidden": false }, "flight_id": { "table_alias": "t", "subfields": [ "flight_no", "airport_code" ], "subfields_navigate_alias": "t0", "subfields_table_alias": [ "t0", "t1" ], "subfields_key": "flight_id" }, "fare_conditions": { "table_alias": "t" }, "amount": { "table_alias": "t" } }, "join": [ { "key": "flight_id", "virtual": false, "schema": "bookings", "entity": "flights", "table_alias": "t0", "parent_table_alias": "t", "entityKey": "flight_id" }, { "key": "departure_airport", "virtual": false, "schema": "bookings", "entity": "airports_data", "table_alias": "t1", "parent_table_alias": "t0", "entityKey": "airport_code" } ], "order": [], "process": null, "functions": [], "format": "array", "desc": "Loading the table \"Flight segment\ "" } ] ``

If the request was successful, the server will send the following data in response:

` {.json} { "jsonrpc": "2.0", "result": { "data": [ [ "0005433805700", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433763343", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005434171107", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433785282", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433785263", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433763347", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433805688", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005434171043", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433763334", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ], [ "0005433805706", "{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}", "Economy", "62100.00" ] ], "records": [ { "count": "161039" } ], "offset": 20, "fields": [ "ticket_no", "flight_id", "fare_conditions", "amount" ], "sql": "SELECT \"t\ ".\"Ticket_no\ ", (row_to_json (row (COALESCE (t0.\"Flight_no\ ":: text, '') || '' || COALESCE (t1.\"Airport_code\ ":: text, ''), t0.\ "flight_id\":: text)) :: text) collate \ "C\" as \ "flight_id\", \ "t\".\ "fare_conditions\", \ "t\".\ "amount\" FROM \ "bookings\".\ "ticket_flights\" as t left join \ "bookings\".\ "flights\" as \ "t0\" on \ "t\".\ "flight_id\" = \ "t0\".\ "flight_id\" left join \ "bookings\".\ "airports_data\" as \ "t1\" on \ "t0\".\ "departure_airport\" = \ "t1\".\ "airport_code\" where (\ "t\".\ "fare_conditions\" = 'Economy') AND (\ "t\".\ "amount\" > '25000') LIMIT 10 OFFSET 20 ", "avg (amount)": [ { "avg": "40528.439073764740" } ] }, "error": null, "usename": "", "pids": 0 } '

  • error - error code with the value “null”;

  • jsonrpc - protocol version with value “2.0”;

  • result - data returned by the method:

    • data - directly a list of table records;

    • offset - offset of records, when requesting lines not from the first line;

    • records - displays the number of records in the table;

    • sql - SQL query to the database;

  • usename - username if authorization was performed.

Requesting a detailed form #

  1. Requesting a detailed form is done using themethod getTableDataPredicate.

If the request is successful, the server will send the following data in response:

  • error - error code with the value “null”;

  • jsonrpc - protocol version with value “2.0”;

  • result - data returned by the method:

    • data - the specified record in the table (all fields and their values);

    • offset - offset of records, when requesting lines not from the first line;

    • records - displays the number of records in the table;

    • sql - SQL query to the database;

  • usename - user login, if authorization was performed.