Web API: Expression/query: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
The Analysis operation runs a query in the server and returns the query results.  
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.  
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 [[QPR_ProcessAnalyzer_Expression_Analysis#Expression_Analysis_Query_Parameters|Expression Analysis parameters]]. Note that all keys are strings, so JSON values need to be stringified.
The request body is a JSON object containing key-value pairs as properties. Available properties are described in the [[QPR_ProcessAnalyzer_Expression_Analysis#Expression_Analysis_Query_Parameters|Expression Analysis parameters]]. Note that all values are strings, so all JSON values need to be stringified.


<pre>
<pre>
Line 10: Line 10:
Body:
Body:
{
{
   Configuration: "{\"Root\":\"Cases\","Dimensions\":[{\"name\":\"Case Duration\",\"expression\":\"Duration.ToInteger(TotalDays)\"}],\"Values\":[{\"name\":\"Case count\",\"expression\":\"Count(_)\"}],\"Ordering\":[{\"Name\":\"Case Duration\",\"Direction\":\"Ascending\"}]",
   ModelId: "123",
   Filter: "{"Items":[{\"Type\":\"IncludeCases\",\"Items\":[{\"Type\":\"CaseAttributeValue\",\"Attribute\":\"Account Manager\",\"Values\":[\"Patricia White\",\"Rober Miller\"]}]}]}",
   Filter: "{"Items":[{\"Type\":\"IncludeCases\",\"Items\":[{\"Type\":\"CaseAttributeValue\",\"Attribute\":\"Account Manager\",\"Values\":[\"Patricia White\",\"Rober Miller\"]}]}]}",
   ModelId: "123",
   Configuration: "{\"Root\":\"Cases\","Dimensions\":[{\"name\":\"Case Duration\",\"expression\":\"Duration.ToInteger(TotalDays)\"}],\"Values\":[{\"name\":\"Case count\",\"expression\":\"Count(_)\"}]}",
   QueryIdentifier: "myQuery1",
   QueryIdentifier: "myQuery1",
   CancelEarlierQueriesWithIdentifier: "true"
   CancelEarlierQueriesWithIdentifier: "true"
Line 26: Line 26:
     "Columns": [
     "Columns": [
       {
       {
         "Caption": "dim"
         "Caption": "Case Duration"
       },
       },
       {
       {
         "Caption": "mea"
         "Caption": "Case count"
       }
       }
     ],
     ],
   "Rows": [
   "Rows": [
       ["50", "4237"], ["51", "4213"], ["52", "4201"], ["53", "4209"], ["54", "4431"], ["55", "42043"]
       ["50", "4237"],
      ["51", "4213"],
      ["52", "4201"],
      ["53", "4209"],
      ["54", "4431"],
      ["55", "42043"]
   ]
   ]
}
}

Revision as of 13:57, 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 and Rows.

Example:

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