Run Analytic Query Post

POST https://api.uniqhealth.io/api_v2//runanalyticqueryml

This POST method will run a query on the Blockchain. It expects a JSON post with the query to run along with either:

  • organization key

or

  • User/password pair

In addition the Unit name and node to interrogate (This can be overridden).

The SQL is Postgresql compliant with some formatting rules

  1. After the FROM key word you must leave 2 spaces. This tells the API that this is a call and to the chain on behalf of either the user with password of, or organization with key of. (Where user, password or key are provided in the JSON.
  2. If a search has a WHERE clause and that clause is looking into encrypted data, then the search term MUST be enclosed in curly braces.
    Eg: authorsearchableglobal LIKE '%bain}%'
    You will see the field name has the searchableglobal appended to it. Please check the schematic got your field names. All searchable fields have the word 'searchable' and then the type 'global' or 'owner' appended. This enables the blockchain to sandbox all data.

{ "unitName": "{unitName}", "type": "{Global/Owner}", "analyticQuery": "SELECT addeddate, position, hash FROM WHERE authorsearchableglobal LIKE '%{bain}%'", "server": "{node address}, "user": "": "password" "": "{{key}}"}

Data is returned in a JSON format. Decrypted where required and only showing non searchable fields and without fieldname additions.

{
results: [
{
warehouse: PWI Mat W/HMain,
invoiceqty: 25,
sentiment: , "rtadate": "01/17/2020 00:00:00", "applicationdate": "01/07/2020 00:00:00", "sentiment2":,
pono: PWI1PRDUO1912140018,
hash: 5007001D9B48BCEDDBEC5A0433137F51,
consumptiondept: PURCHASING,
incomingqty: 25,
location: Import,
invoicedate: 12/26/2019 00:00:00,
accountingconfdate: 02/06/2020 00:00:00,
command: addBlock,
department: PURCHASING,
addeddate: 05/18/2022 16:00:52,
incomingdtvspo: 25,
applicationdtvsinv: 12,
incomingdtvsrtd: 5,
supplier: B00448,
poyn: Y,
unit: M,
position: 8,
podate: 12/14/2019 00:00:00,
context: sales,
poqty: 25,
context2: ", supplieragency:B00448, lasthash:5C1060199D3156D6E053CDBA9F1BB98D, materialname:MEEKRON II DE 7, rtddate:01/03/2020 00:00:00, incomingdate:01/08/2020 00:00:00"
}

]}

Request Body

{"showEmptyFields"=>false, "analyticQuery"=>"SELECT * FROM .ez_biome_chrom LIMIT 1;", "showProtected"=>true, "user"=>"12345_c", "unitName"=>"uniq_client_data"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring

RESPONSES

status: OK

{}