The Blawx Reasoner API

The Blawx Reasoner API

The alpha version of the Blawx Reasoner API is located at https://www.blawx.com/reasoner6.php. It accepts urlencoded POST requests, and expects two parameters: code, and data. Code is set to the contents of a .blawx file. Data is set to a JSON package of data.

Blawx will process the JSON package by converting it into a data dictionary block. For testing purposes, and to refer to the elements of the data packet in your Blawx code, see the documentation on data dictionary blocks, and data property blocks..

The reasoner will search your code for queries, and will ask only the first query it finds. The output is a JSON block is structured as follows:

{
  'main': 'Yes'|'No'
  '1': {
    variable1: value1,
    variable2: value2,
    ...
    variablen: valuen
  }
  ...
  'n': {
    ...
  }
}

If the query was a yes/no query, the only property returned will be ‘main’, with the answer the reasoner got.

If the query was a search that returned no results, the only thing returned will be ‘main’, which will have the value ‘No’.

If the query was a search that returned results, each result will be enumerated, and each included variable in the query will be listed as a property of that result.

For a working example, take a look at the Blawx module for docassemble.

No Comments

Add your comment