- 14 Minutes to read
- Print
- DarkLight
Create calculation query
- 14 Minutes to read
- Print
- DarkLight
Create a calculation query.
Response will be either
- 200 if the result is already available and can be retrieved by using the provided link (or calculationId)
- 201 if the calculation is being queued. Status can be polled by using the provided link (or correlationId).
Analytics Request Format
{
"resultType": "DATA_ONLY",
"queryObject": {
"columns": [
{
"name": "time_days",
"sortDirection": "ASCENDING",
"sortIndex": "0",
"scope": "OBJECT",
"context": "NONE",
"lowerLimit": "1",
"upperLimit": "7"
},
{
"name": "os_vendor",
"context": "SESSION",
"lowerLimit": "1",
"upperLimit": "10",
"scope": "OBJECT"
},
{
"name": "visits",
"columnPeriod": "ANALYSIS",
"sortDirection": "DESCENDING",
"sortIndex": "1",
"scope": "OBJECT",
"context": "SESSION"
},
{
"name": "pages_pageImpressions",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT",
"context": "PAGE"
},
{
"name": "visits_newShare",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT"
},
{
"name": "visit_duration_avg",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT"
},
{
"name": "visits_bounceRate",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT"
},
{
"name": "visits",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT",
"context": "SESSION",
"predefinedContainer": {
"filters": [
{
"name": "os_vendor",
"caseSensitive": false,
"context": "SESSION",
"filterPredicate": "LIKE",
"connector": "AND",
"value1": "Apple",
"value2": ""
}
],
"containers": []
}
}
],
"variant": "PIVOT",
"predefinedContainer": {
"filters": [
{
"name": "time_dynamic",
"filterPredicate": "LIKE",
"connector": "AND",
"caseSensitive": false,
"context": "NONE",
"intern": false,
"value1": "last_7_days",
"value2": ""
}
],
"containers": []
}
}
}
{
"resultType": "DATA_ONLY",
"queryObject": {
"columns": [
{
"name": "browser_fullName",
"scope": "OBJECT",
"context": "SESSION",
"variant": "NORMAL",
"lowerLimit": "1",
"upperLimit": "20"
},
{
"name": "visits",
"columnPeriod": "ANALYSIS",
"sortDirection": "DESCENDING",
"sortIndex": "1",
"scope": "OBJECT",
"context": "SESSION",
"variant": "NORMAL"
}
],
"viewMode": {
"active": "comparison",
"comparison": {
"type": "time",
"values": {
"time": [
{
"name": "time_dynamic",
"value1": "last_14_days",
"value2": "",
"filterPredicate": "LIKE",
"connector": "AND",
"context": "NONE",
"caseSensitive": false
},
{
"name": "time_dynamic",
"value1": "last_14_days_previous_year",
"value2": "",
"filterPredicate": "LIKE",
"connector": "AND",
"context": "NONE",
"caseSensitive": false
}
],
"segment": []
},
"sorting": {
"time": [
{
"resultColumn": "2",
"direction": "DESCENDING"
}
],
"segment": []
}
}
},
"variant": "LIST",
"predefinedContainer": {
"filters": [
{
"name": "time_range",
"filterPredicate": "BETWEEN",
"connector": "AND",
"caseSensitive": false,
"context": "NONE",
"value1": "2022-12-23 00:00:00",
"value2": "2023-01-20 00:00:00"
}
],
"containers": []
}
}
}
{
"resultType": "DATA_ONLY",
"queryObject": {
"columns": [
{
"name": "pages",
"scope": "OBJECT",
"context": "PAGE",
"variant": "NORMAL",
"lowerLimit": "1",
"upperLimit": "20"
},
{
"name": "pages_pageImpressions",
"columnPeriod": "ANALYSIS",
"sortDirection": "DESCENDING",
"sortIndex": "1",
"scope": "OBJECT",
"context": "PAGE",
"variant": "NORMAL",
"inTimeSeries": true
},
{
"name": "visits",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT",
"context": "SESSION",
"variant": "NORMAL"
},
{
"name": "pages_durationAvg",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT",
"variant": "NORMAL",
"inTimeSeries": true
},
{
"name": "visits_bounceRate",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT",
"variant": "NORMAL"
},
{
"name": "pages_exitRate",
"columnPeriod": "ANALYSIS",
"scope": "OBJECT",
"variant": "NORMAL"
}
],
"viewMode": {
"active": "timeSeries",
"timeSeries": {
"timeName": "time_days",
"values": [
"Search",
"Home",
"Cart"
],
"top": "3",
"viewType": "top"
}
},
"predefinedContainer": {
"filters": [
{
"name": "time_dynamic",
"connector": "AND",
"filterPredicate": "LIKE",
"value1": "last_28_days",
"value2": "",
"context": "NONE",
"caseSensitive": false
}
],
"containers": []
},
"variant": "LIST"
}
}
Defintiona of a anaylsis query structure
Type of result
Different type of queries are possible
Array of columns
Possible sorting directions
Indicates order of sorting when there is more than one sorting column. (starting from 0).
Optional property indicating if a column will be used in time series view mode; defaults to false. Can be omitted if it's value is not set to true.
Indicates which Time range must be used for the column. ANALYSIS: uses the analysis time range. COLUMN: uses the time filter defined inside the column. ELEMENT: uses the time filter defined inside the element configuration - i.e. custom metric/formula
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Array of filters
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
array of containers (recursion)
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates how filters must be applied. TIME_ORDER is sequential, NORMAL not
Type of Data Structure
Array of filters
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
array of containers (recursion)
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates how filters must be applied. TIME_ORDER is sequential, NORMAL not
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
type of comparison. It can be either on time or segment. The corresponding properties must be filled accordingly in values and sorting
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
ID of the Segment
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates segment ordering in case of several Segment
Sorting of comparison
alias of the column being sorted
Possible sorting directions
Sorting of comparison
alias of the column being sorted
Possible sorting directions
The name of the time dimension used in the time series - i.e. "time_days" for days.
The type of the time series view mode. Set "top" for time series of the top "x" number of objects. Set "values" based on specific object values populated in the values list of this configuration.
The number of top objects the time series is build upon.
A list of object values - i.e. ["Seach", "Cart", "Home"] for object "pages".
One of the following periods should be used:
- ELEMENT: when the time filter is either inherited from the report or the time filter configured in the report element configuration.
- MONAD: when the time filter is inherited from the custom metric configuration.
Type of the query
name of the metric of the KPI
name of the dimension of the KPI
Comparison definition
Type of comparison
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
Array of filters
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
array of containers (recursion)
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates how filters must be applied. TIME_ORDER is sequential, NORMAL not
Name of the Metric or Dimension being filtered.
Filter predicates
Connectors
Context to evaluate the metric/dimension. If context property is not given or empty the default context of the object will be used. The default context can be identified from the context property in the response list of /query-objects.
Indicates if filter should be prioritized (Advanced).
Analysis completed
{
"calculationId": "8612fa1eaada53fbb1956402bbded4db732074e7e399645880ae6a54b99a2bd9_294915650484552",
"resultUrl": "https://analytics-qa.nbg.webtrekk.com/analytics-service/intelligence-api/analysis-result/8612fa1eaada53fbb1956402bbded4db732074e7e399645880ae6a54b99a2bd9_294915650484552"
}
Analysis enqueued
{
"correlationId": "94295cef-5b64-4934-ba25-011dd997aa81",
"statusUrl": "https://analytics-qa.nbg.webtrekk.com/analytics-service/intelligence-api/analysis-query/94295cef-5b64-4934-ba25-011dd997aa81"
}
No permission to execute operation
Invalid Token
{
"title": "Invalid Token",
"status": 403,
"detail": "Token not valid",
"statusCode": "INVALID_TOKEN"
}
HTTP Status Code
Specific Mapp Error Code
Short description of the problem
Detailed informations about the problem
Each error has specific properties described in following table:
Error | Description | Relevant parameters |
---|---|---|
UnmappedName | At least one object name cannot be found. | List of objects not found in names array. |
PivotIncompatibleMetric | Metric not usable in Pivot detected. | List of incompatible Metrics in names array. |
PivotIncompatibleDimension | Dimension not usable in Pivot detected. | List of incompatible Dimensions in names array. |
AnalysisLogicalCubeMismatch | All Dimensions and Metrics are not compatible. | List of incompatible objects in names array. |
InvalidSortingCriteria | Sorting is applied on a non-sortable object. | List of invalid sorted objects in names array. |
TimeFilterMissing | Each query must have a minimum of one Time Filter. | N/A |
InvalidSegmentNoneContainer | A segment container has context set to NONE but either its connector is not set to AND or its inOrNotIn property is not set to IN. | N/A |
List of internal object names (dimension, metrics, filter, ...) that corresponds to the error.
List of columns aliases that corresponds to the error. See Result Header alias property.
List of object names (dimension, metrics, filter, ...) that corresponds to the error.
Each warnings has specific properties described in following table:
Warning | Description | Relevant parameters |
---|---|---|
FilterLogicalCubeMismatch | At least one filter is ignored due to incompatibily with Dimensions and Metrics used. | List of incomptible filter objects in names array. |
InvalidMetricContext | Metric used in an invalid context. | List of metric with invalid context in aliases array. |
SortingEnforced | Sorting criteria has been added automatically | List of objects that were sorted automatically in aliases array. |
NoSortingDefined | Sorting criteria is required for some dimensions. | List of dimensions requiring a sorting in names array. |
SortingLimitExceeded | 3 sorting criteria are allowed. All additional sorting criteria have been omitted. | List of columns ignored for sorting in aliases array. |
SortingRemoved | A requested sorting criteria has been removed | List of objects that were removed automatically in aliases array. |
TodayRemoved | Today date has been removed from calculation time range because the selected datasource does not contain it. | daysInDataSource, todayDate |
List of internal object names (dimension, metrics, filter, ...) that corresponds to the warning.
List of columns aliases that corresponds to the error. See Result Header alias property.
List of object names (dimension, metrics, filter, ...) that corresponds to the warning.
Number of days in the datasource which is beeing cut
Date of the day being cut
Invalid JSON input
HTTP Status Code
Specific Mapp Error Code
Short description of the problem
Detailed informations about the problem
Each error has specific properties described in following table:
Error | Description | Relevant parameters |
---|---|---|
UnmappedName | At least one object name cannot be found. | List of objects not found in names array. |
PivotIncompatibleMetric | Metric not usable in Pivot detected. | List of incompatible Metrics in names array. |
PivotIncompatibleDimension | Dimension not usable in Pivot detected. | List of incompatible Dimensions in names array. |
AnalysisLogicalCubeMismatch | All Dimensions and Metrics are not compatible. | List of incompatible objects in names array. |
InvalidSortingCriteria | Sorting is applied on a non-sortable object. | List of invalid sorted objects in names array. |
TimeFilterMissing | Each query must have a minimum of one Time Filter. | N/A |
InvalidSegmentNoneContainer | A segment container has context set to NONE but either its connector is not set to AND or its inOrNotIn property is not set to IN. | N/A |
List of internal object names (dimension, metrics, filter, ...) that corresponds to the error.
List of columns aliases that corresponds to the error. See Result Header alias property.
List of object names (dimension, metrics, filter, ...) that corresponds to the error.
Each warnings has specific properties described in following table:
Warning | Description | Relevant parameters |
---|---|---|
FilterLogicalCubeMismatch | At least one filter is ignored due to incompatibily with Dimensions and Metrics used. | List of incomptible filter objects in names array. |
InvalidMetricContext | Metric used in an invalid context. | List of metric with invalid context in aliases array. |
SortingEnforced | Sorting criteria has been added automatically | List of objects that were sorted automatically in aliases array. |
NoSortingDefined | Sorting criteria is required for some dimensions. | List of dimensions requiring a sorting in names array. |
SortingLimitExceeded | 3 sorting criteria are allowed. All additional sorting criteria have been omitted. | List of columns ignored for sorting in aliases array. |
SortingRemoved | A requested sorting criteria has been removed | List of objects that were removed automatically in aliases array. |
TodayRemoved | Today date has been removed from calculation time range because the selected datasource does not contain it. | daysInDataSource, todayDate |
List of internal object names (dimension, metrics, filter, ...) that corresponds to the warning.
List of columns aliases that corresponds to the error. See Result Header alias property.
List of object names (dimension, metrics, filter, ...) that corresponds to the warning.
Number of days in the datasource which is beeing cut
Date of the day being cut