Web API: Expression/query: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
</pre>
</pre>


Response is a JSON object with several properties. The '''Contents''' property contains the result data. The ''Contents'' property is an object with properties '''Columns''' and '''Rows'''.
Response is a JSON object with several properties. The '''Contents''' property contains the result data. The ''Contents'' property is an object with properties '''Columns''' (array of column objects) and '''Rows''' (array of rows; each row is an array of values).


Example:
In the cell values, the first character is the data type and rest of the characters are the value which interpretation depends on the data type as follows:
* 0: string
* 1: float number. May contain a decimal point (.)
* 2: date in the form yyyy-MM-ddTHH:mm:ss.fff
* 3: null value. There is no value part.
* 4: small integer (32 bit)
* 5: large integer (64 bit)
* 6: boolean. Value is either ''True'' or ''False''
 
Example response:
<pre>
<pre>
{
{

Revision as of 14:02, 16 May 2020

The Analysis operation runs a query in the server and returns the query results.

HTTP request header Authorization with value Bearer <access token> needs to be in place to identify the session.

The request body is a JSON object containing key-value pairs as properties. Available properties are described in the Expression Analysis parameters. Note that all values are strings, so all JSON values need to be stringified.

Url: POST /api/analysis/33
Content-Type: application/json;charset=UTF-8
Body:
{
  ModelId: "123",
  Filter: "{"Items":[{\"Type\":\"IncludeCases\",\"Items\":[{\"Type\":\"CaseAttributeValue\",\"Attribute\":\"Account Manager\",\"Values\":[\"Patricia White\",\"Rober Miller\"]}]}]}",
  Configuration: "{\"Root\":\"Cases\","Dimensions\":[{\"name\":\"Case Duration\",\"expression\":\"Duration.ToInteger(TotalDays)\"}],\"Values\":[{\"name\":\"Case count\",\"expression\":\"Count(_)\"}]}",
  QueryIdentifier: "myQuery1",
  CancelEarlierQueriesWithIdentifier: "true"
}

Response is a JSON object with several properties. The Contents property contains the result data. The Contents property is an object with properties Columns (array of column objects) and Rows (array of rows; each row is an array of values).

In the cell values, the first character is the data type and rest of the characters are the value which interpretation depends on the data type as follows:

  • 0: string
  • 1: float number. May contain a decimal point (.)
  • 2: date in the form yyyy-MM-ddTHH:mm:ss.fff
  • 3: null value. There is no value part.
  • 4: small integer (32 bit)
  • 5: large integer (64 bit)
  • 6: boolean. Value is either True or False

Example response:

{
  "Contents": {
    "Columns": [
      {
        "Caption": "Case Duration"
      },
      {
        "Caption": "Case count"
      }
    ],
  "Rows": [
      ["50", "4237"],
      ["51", "4213"],
      ["52", "4201"],
      ["53", "4209"],
      ["54", "4431"],
      ["55", "42043"]
  ]
}