The latest version for DAS is WSO2 Data Analytics Server 3.2.0. View documentation for the latest release.
WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3

Overview

DescriptionRetrieving aggregated values of given records
Resource Path

/analytics/aggregates

HTTP MethodPOST
Request/Response Formatapplication/json
AuthenticationBasic
Parameter description
ParameterDescription
tableName
The name of the event table for which this query should be run.
parentPath
This specifies whether the aggregate should be calculated for a child category within a specific category. When you specify a parent path, everything that is not included in that path is ignored when the groupBy operation is executed. Therefore, this parameter also plays the role of a filter.
aggregateLevel
This specifies the level up to which the aggregation should be done. This is specified relative to the parent path.
groupByField
This represents the GROUP BY equivalent in SQL, and specifies the field by which the retrieved values should be grouped.
aggregateFields

This is an array of JSON objects. Each object represents the field that you want to aggregate.

  • fieldName: This is the field that should be aggregated.
  • aggregate: This is the aggregate function that should be used.
  • alias: This is the field name that is used for the aggregated result.

 


Example

Code Block
languagepowershell
GET https://localhost:9443/analytics/aggregates
{
 "tableName":"test2",
"parentPath": [],
"aggregateLevel": 0,
 "groupByField":"facet",
 "aggregateFields":[
   {
     "fieldName":"n",
     "aggregate":"AVG",
     "alias":"result_avg"
   },
   {
     "fieldName":"n",
     "aggregate":"MAX",
     "alias":"result_max"
   }]
}

Sample output

Code Block
languagetext
[{
    "id":"14399961246350.13125980939205978",
    "tableName":"test2","timestamp":1439996124610,
    "values":{
        "result_avg":"20",
        "result_max":"22",
        "single_valued_facet_field":[engineering] //This should be a facet with a single value.
    }
},
{
    "id":"14399961246350.13125980939205999",
    "tableName":"test2","timestamp":1439996124610,
    "values":{
        "result_avg":"34",
        "result_max":"46"
        "single_valued_facet_field":[marketing] //This should be a facet with a single value.
    }
}
  
]

REST API response

...


HTTP status code

200

For descriptions of the HTTP status codes, see HTTP Status Codes.

  • Download PDF icon Download PDF
  • Download a PDF file of the documentation