REST API documentation version v1
Base URL: https://cloud.kaaiot.com/api/v1/rs
Evaluation
Evaluate schemas and operations for query execution.
Executes a query to retrieve data for the report table.
post /evaluate
Executes a query to retrieve data for the report table.
- tenant:report:evaluate
AM supports OAuth 2.0 for authenticating all API requests.
Body
Media type: application/json
Type: object
Properties- application: required(string)
Application name.
- timestampColumn: (string)
Elastic timestamp column name to search.
- from: required(string)
Specify the start of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - to: required(string)
Specify the end of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - dimensions: required(array of table.DimensionColumn)
List of columns that going to be used as group by queries dimensions.
Items: DimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the dimension's source value is absent, null, or empty string. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, missing/null/empty dimension values are replaced with
defaultValue. Defaults to false (existing behaviour preserved).
- name: (string)
- columns: required(array of table.AggregationColumn)
Specifies the aggregation columns.
Items: AggregationColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- function: required(one of SUM, AVG, MIN, MAX, COUNT, LAST)
Aggregation function to be applied.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the aggregation result is absent or null. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, null/absent aggregation results are replaced with
defaultValue. Additionally, when at least one aggregation column has this enabled, rows are created for dimension members (e.g. from metadata) that have no analytics data, with aggregation columns filled from their configured defaults. Defaults to false (existing behaviour preserved).
- name: (string)
- timeDimension: required(array of table.TimeHistDimensionColumn)
Time histogram component of the group by queries dimensions.
Items: TimeHistDimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- calendarInterval: required(string)
Calendar interval passed to the elasticsearch.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- name: (string)
- where: required(array of table.WhereColumn)
Filter conditions to be applied to the data.
Items: WhereColumn
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Column type.
- function: required(one of EQ, IN, LAST, IN_RANGE)
Filter function to be applied.
- value: required(object)
Value to be applied for filtering.
- from: required(string)
Used for filtering in the IN_RANGE function.
- to: required(string)
Used for filtering in the IN_RANGE function.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Example:
{
"dimensions": [
{
"source": "ANALYTICS",
"name": "Device ID",
"path": "endpointId.keyword",
"type": "STRING"
},
{
"source": "METADATA",
"name": "Vehicle name",
"path": "name",
"type": "STRING",
"useDefaultValue": true,
"defaultValue": "unknown"
},
{
"source": "ASSET",
"name": "Vehicle brand",
"path": "dataSample.relations.IS_CONTAINED_BY.entityId.asset_tp_f8bc6ed6:brand",
"type": "STRING"
}
],
"columns": [
{
"source": "ANALYTICS",
"name": "Average speed",
"path": "dataSample.speed",
"type": "NUMBER",
"function": "AVG",
"expression": "{{average speed}} km/h",
"useDefaultValue": true,
"defaultValue": 0
}
],
"where": [
{
"source": "METADATA",
"path": "connected",
"type": "BOOL",
"function": "EQ",
"value": true
}
],
"application": "cnc5h752908c73fp4pd0",
"from": "now-10h",
"to": "now"
}HTTP status code 202
Data successfully retrieved.
Body
Media type: application/json
Type: array of object
Example:
[
{
"Device ID": "568b5afe-2437-468b-b57b-1335b499f589",
"Vehicle name": "Toyota",
"Vehicle brand": "Corolla",
"Average speed": "45 km/h"
},
{
"Device ID": "fa489f9b-295d-41ae-a425-5a52dce0ed21",
"Vehicle name": "Honda",
"Vehicle brand": "Civic",
"Average speed": "60 km/h"
}
]HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Retrieves the schema necessary to build a query for generating a report.
get /evaluate/schema
Retrieves the schema necessary to build a query for generating a report.
- tenant:report:evaluate
AM supports OAuth 2.0 for authenticating all API requests.
Query Parameters
- application: required(string)
Application name.
HTTP status code 200
Schema successfully retrieved.
Body
Media type: application/json
Type: object
Example:
{
"TIME_SERIES": [
{
"path": "endpointId",
"type": "STRING"
},
{
"path": "auto~humidity.value",
"type": "NUMBER"
}
],
"METADATA": [
{
"path": "name",
"type": "STRING"
},
{
"path": "connected",
"type": "BOOL"
}
],
"ALERTS": [
{
"path": "severityLevel",
"type": "STRING"
},
{
"displayName": "maxSpeed",
"path": "entityMetadata.maxSpeed",
"type": "STRING"
}
],
"ANALYTICS": [
{
"path": "endpointId.keyword",
"type": "STRING"
},
{
"displayName": "speed",
"path": "dataSample.speed",
"type": "STRING"
}
],
"ASSETS": [
{
"displayName": "Vehicle:brand",
"path": "dataSample.relations.IS_CONTAINED_BY.entityId.asset_tp_f8bc6ed6:brand",,
"type": "STRING"
}
]
}HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Retrieves allowed operations on the schema required to build a query for generating a report.
get /evaluate/schema/operations
Retrieves allowed operations on the schema required to build a query for generating a report.
HTTP status code 200
Operations successfully retrieved.
Body
Media type: application/json
Type: object
Example:
{
"TIME_SERIES": [
{
"type": "STRING",
"allowedStages": [
"DIMENSION"
]
}
],
"ANALYTICS": [
{
"type": "STRING",
"allowedStages": [
"DIMENSION",
"WHEN_CONDITION",
"AGGREGATION"
],
"aggregationFunctions": [
"COUNT",
"LAST"
],
"filterFunctions": [
"EQ",
"IN"
]
},
{
"type": "NUMBER",
"allowedStages": [
"AGGREGATION",
"DIMENSION",
"WHEN_CONDITION"
],
"aggregationFunctions": [
"MIN",
"AVG",
"SUM",
"MAX",
"COUNT",
"LAST"
],
"filterFunctions": [
"EQ",
"IN"
]
},
{
"type": "DATE",
"allowedStages": [
"DIMENSION",
"TIME_DIMENSION",
"WHEN_CONDITION",
"AGGREGATION"
],
"aggregationFunctions": [
"MAX",
"MIN",
"COUNT",
"LAST"
],
"filterFunctions": [
"IN_RANGE"
]
},
{
"type": "BOOL",
"allowedStages": [
"DIMENSION",
"WHEN_CONDITION",
"AGGREGATION"
],
"aggregationFunctions": [
"COUNT",
"LAST"
],
"filterFunctions": [
"EQ"
]
}
],
"METADATA": [
{
"type": "BOOL",
"allowedStages": [
"DIMENSION",
"WHEN_CONDITION"
],
"filterFunctions": [
"EQ"
]
}
]
}Templates
Operations on report templates.
Creates a new report template.
Retrieves templates.
post /templates
Creates a new report template.
- template:create
AM supports OAuth 2.0 for authenticating all API requests.
Body
Media type: application/json
Type: object
Properties- name: required(string)
Template name.
- reportName: (string)
The name of the report to be generated. If not provided, the template name will be used.
Can include the following placeholders:
- "{{createdDate}}"
- "{{createdDateTime}}"
- "{{fromDate}}"
- "{{fromDateTime}}"
- "{{toDate}}"
- "{{toDateTime}}"
Example:
Report_Name_{{createdDate}} - executionState: (one of ACTIVE, INACTIVE - default: ACTIVE)
Represents the state of the template execution. When set to ACTIVE, all triggers associated with the template will be enabled.
- triggers: (array of string)
IDs of triggers associated with this template. These trigger IDs define when the report should be generated.
- exportType: (one of CSV_IN_ZIP, PDF, EXCEL - default: CSV_IN_ZIP)
The format of the report in which the notification will be sent.
- exportTemplate: (object)
Offers customization options to define the layout and content of report exports.
Placeholders for report data:
- "${reportName}": The name of the report.
- "${reportCreatedDate}": The creation date of the report.
- "${reportCreatedDateTime}": The creation date and time of the report.
Placeholders for each table:
- "${table.name}": Table name.
- "${table.description}": Table description.
- "${table.application}": Application name.
- "${table.fromDate}": Start date of the table data.
- "${table.fromDateTime}": Start date and time of the table data.
- "${table.toDate}": End date of the table data.
- "${table.toDateTime}": End date and time of the table data.
- "${table.headers}": Table headers.
- "${table.data}": Table data.
If not provided, a default template will be used.
- pdfTemplate: (string)
Content of the FreeMarker template for customizing PDF report exports.
- csvTemplate: (string)
Content of the FreeMarker template for customizing CSV report exports.
- emailTemplate: (object)
Notifies recipients that a report has been generated and is available for download.
- recipients: (array of string)
A list of email addresses of the recipients.
- subject: (string - default: Kaaiot Report)
The subject line of the email notification.
- template: (string)
The HTML content of the email notification. If not provided, a default template will be used.
Can include the following placeholders:
- "{{report_download_link}}": Link to download the report.
- "{{report_name}}": Name of the generated report.
- "{{year}}": Current year.
- recipients: (array of string)
- poolIds: (array of string)
An array of the unique identifiers of the pools to which the template will be attached.
Example:
{
"name": "Monthly Sensor Readings",
"reportName": "sensor__readings__{{createdDate}}",
"exportType": "PDF",
"executionState": "ACTIVE",
"triggers": [
"aa3f7b8d-3a22-46e8-8803-e89480ff73f1"
],
"exportTemplate": {
"pdfTemplate": "<html><head><table><thead><tr><#list table.headers as header><th>${header}</th></#list></tr></thead></table></#list></body></html>",
"csvTemplate": "${table.headers?join(\",\")}"
},
"emailTemplate": {
"subject": "Sensor Readings Report",
"template": "<html><body><p>{{report_name}}</p></body></html>",
"recipients": [
"example@kaaiot.io"
]
},
"poolIds": [
"aXJuOnJjNzNkYmg3cTA6aWFtY29yZTo0YXRjaWNuaXNnOjpwb29sL2Rldg=="
]
}HTTP status code 201
Item is successfully created.
Headers
- Location: required(string)
URI in format
{schema}://{host}/rs/api/v1/templates/{templateId}Example:
https://cloud.kaaiot.com/rs/api/v1/templates/3d37097f-3258-4b16-b2e7-2e6df97a303b
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
get /templates
Retrieves templates.
- template:read
AM supports OAuth 2.0 for authenticating all API requests.
Query Parameters
- templateId: (array of )
Template IDs.
- name: (string)
Template name. Supports partial match.
- executionState: (one of ACTIVE, INACTIVE)
State of the template execution.
- page: (number - default: 0)
Page number.
Example:
0 - size: (number - default: 100)
Page size.
Example:
10 - sort: (one of createdAt, updatedAt - default: createdAt)
Field to sort by.
Example:
updatedAt - sortOrder: (one of asc, desc - default: desc)
Sort direction.
Example:
asc
HTTP status code 200
List is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- totalElements: required(integer)
Total number of elements available for retrieval.
- content: required(array of template.ItemResponse)
Items: ItemResponse
- id: required(string)
Template ID.
- name: required(string)
Template name.
- executionState: required(one of ACTIVE, INACTIVE)
Represents the state of the template execution. When set to ACTIVE, all triggers associated with the template will be enabled.
- triggers: (array of trigger.ItemResponse)
Triggers associated with this template.
Items: ItemResponse
- id: required(string)
Trigger ID.
- tenantId: required(string)
Tenant ID.
- name: required(string)
Trigger name.
- description: (string)
Description and notes for this trigger.
- cronLine: required(string)
Quartz cron line
- type: required(CRON)
Specifies the type of trigger mechanism.
- poolIds: (array of string)
Pool IDs the trigger attached to.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was created.
- updatedAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated.
- id: required(string)
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the template was created.
- updatedAt: (datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the template was last updated.
- id: required(string)
Example:
{
"totalElements": 1,
"content": [
{
"id": "3d37097f-3258-4b16-b2e7-2e6df97a303b",
"name": "Monthly Sensor Readings",
"executionState": "ACTIVE",
"triggers": [
{
"id": "aa3f7b8d-3a22-46e8-8803-e89480ff73f1",
"tenantId": "qs73c8ovqg",
"name": "Monthly Trigger",
"description": "On the last day of the month, every month",
"type": "CRON",
"cronLine": "0 0 0 L * ?",
"createdAt": "2024-03-26T15:00:00.000Z",
"updatedAt": "2024-04-26T15:00:00.000Z"
}
],
"createdAt": "2024-04-26T15:00:00.000Z",
"updatedAt": "2024-04-26T15:00:00.000Z"
}
]
}HTTP status code 401
Request is not authenticated.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Deletes template.
Retrieves template.
Updates template.
delete /templates/{templateId}
Deletes template.
- template:delete
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
HTTP status code 204
Template is successfully deleted.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
get /templates/{templateId}
Retrieves template.
- template:read
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
HTTP status code 200
Template is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- id: required(string)
Template ID.
- name: required(string)
Template name.
- reportName: required(string)
The name of the report to be generated.
- tenantId: required(string)
Tenant ID.
- executionState: required(one of ACTIVE, INACTIVE)
Represents the state of the template execution. When set to ACTIVE, all triggers associated with the template will be enabled.
- triggers: (array of trigger.ItemResponse)
Triggers associated with this template.
Items: ItemResponse
- id: required(string)
Trigger ID.
- tenantId: required(string)
Tenant ID.
- name: required(string)
Trigger name.
- description: (string)
Description and notes for this trigger.
- cronLine: required(string)
Quartz cron line
- type: required(CRON)
Specifies the type of trigger mechanism.
- poolIds: (array of string)
Pool IDs the trigger attached to.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was created.
- updatedAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated.
- id: required(string)
- exportType: (one of CSV_IN_ZIP, PDF, EXCEL - default: CSV_IN_ZIP)
The format of the report in which the notification will be sent.
- exportTemplate: (object)
Offers customization options to define the layout and content of report exports.
- pdfTemplate: (string)
Content of the FreeMarker template for customizing PDF report exports.
- csvTemplate: (string)
Content of the FreeMarker template for customizing CSV report exports.
- pdfTemplate: (string)
- emailTemplate: (object)
Notifies recipients that a report has been generated and is available for download.
- subject: (string - default: Kaaiot Report)
The subject line of the email notification.
- template: (string)
The HTML content of the email notification.
- recipients: (array of string)
A list of email addresses of the recipients.
- subject: (string - default: Kaaiot Report)
- tables: (array of table.ItemResponse)
List of table templates.
Items: ItemResponse
- id: required(string)
Table ID.
- name: required(string)
Table name.
- description: (string)
Description and notes for this table.
- orderIndex: (number)
Specifies the sequence or position of the table in the report.
- query: required(object)
The query used to retrieve data for the table.
- application: required(string)
Application name.
- timestampColumn: (string)
Elastic timestamp column name to search.
- from: required(string)
Specify the start of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - to: required(string)
Specify the end of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - dimensions: required(array of table.DimensionColumn)
List of columns that going to be used as group by queries dimensions.
Items: DimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the dimension's source value is absent, null, or empty string. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, missing/null/empty dimension values are replaced with
defaultValue. Defaults to false (existing behaviour preserved).
- name: (string)
- columns: required(array of table.AggregationColumn)
Specifies the aggregation columns.
Items: AggregationColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- function: required(one of SUM, AVG, MIN, MAX, COUNT, LAST)
Aggregation function to be applied.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the aggregation result is absent or null. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, null/absent aggregation results are replaced with
defaultValue. Additionally, when at least one aggregation column has this enabled, rows are created for dimension members (e.g. from metadata) that have no analytics data, with aggregation columns filled from their configured defaults. Defaults to false (existing behaviour preserved).
- name: (string)
- timeDimension: required(array of table.TimeHistDimensionColumn)
Time histogram component of the group by queries dimensions.
Items: TimeHistDimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- calendarInterval: required(string)
Calendar interval passed to the elasticsearch.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- name: (string)
- where: required(array of table.WhereColumn)
Filter conditions to be applied to the data.
Items: WhereColumn
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Column type.
- function: required(one of EQ, IN, LAST, IN_RANGE)
Filter function to be applied.
- value: required(object)
Value to be applied for filtering.
- from: required(string)
Used for filtering in the IN_RANGE function.
- to: required(string)
Used for filtering in the IN_RANGE function.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
- application: required(string)
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was created.
Example:
2023-06-30T12:30:54.540Z - updatedAt: (datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated.
Example:
2023-06-30T12:30:54.540Z
- id: required(string)
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the template was created.
- updatedAt: (datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the template was last updated.
Example:
{
"id": "3d37097f-3258-4b16-b2e7-2e6df97a303b",
"name": "Monthly Sensor Readings",
"reportName": "sensor__readings__{{createdDate}}",
"executionState": "ACTIVE",
"tenantId": "qs73c8ovqg",
"exportType": "PDF",
"exportTemplate": {
"pdfTemplate": "<html><head><table><thead><tr><#list table.headers as header><th>${header}</th></#list></tr></thead></table></#list></body></html>",
"csvTemplate": "${table.headers?join(\",\")}"
},
"triggers": [
{
"id": "aa3f7b8d-3a22-46e8-8803-e89480ff73f1",
"tenantId": "qs73c8ovqg",
"name": "Monthly Trigger",
"description": "On the last day of the month, every month",
"type": "CRON",
"cronLine": "0 0 0 L * ?",
"createdAt": "2024-03-26T15:00:00.000Z",
"updatedAt": "2024-04-26T15:00:00.000Z"
}
],
"emailTemplate": {
"subject": "Sensor Readings Report",
"template": "<html><body><p>{{report_name}}</p></body></html>",
"recipients": [
"example@kaaiot.io"
]
},
"tables": [
{
"id": "768b5afe-2437-468b-b77b-1335b499f588",
"name": "Sensor humidity readings",
"description": "Sensor FMC-500",
"query": {
"dimensions": [
{
"source": "METADATA",
"path": "name",
"type": "STRING"
},
{
"source": "TIME_SERIES",
"path": "endpointId",
"type": "NUMBER"
},
{
"source": "TIME_SERIES",
"name": "humidity",
"path": "auto~humidity",
"type": "NUMBER"
}
],
"application": "cnc5h752908c73fp4pd0",
"from": "now-1h",
"to": "now"
}
}
],
"createdAt": "2024-04-26T15:00:00.000Z",
"updatedAt": "2024-04-26T15:00:00.000Z"
}HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
put /templates/{templateId}
Updates template.
- template:update
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
Body
Media type: application/json
Type: object
Properties- name: required(string)
Report template name.
- reportName: required(string)
The name of the report to be generated. If not provided, the template name will be used.
Can include the following placeholders:
- "{{createdDate}}"
- "{{createdDateTime}}"
- "{{fromDate}}"
- "{{fromDateTime}}"
- "{{toDate}}"
- "{{toDateTime}}"
Example:
Report_Name_{{createdDate}} - exportType: required(one of CSV_IN_ZIP, PDF, EXCEL)
The format of the report in which the notification will be sent.
- exportTemplate: (object)
Offers customization options to define the layout and content of report exports.
Placeholders for report data:
- "${reportName}": The name of the report.
- "${reportCreatedDate}": The creation date of the report.
- "${reportCreatedDateTime}": The creation date and time of the report.
Placeholders for each table:
- "${table.name}": Table name.
- "${table.description}": Table description.
- "${table.application}": Application name.
- "${table.fromDate}": Start date of the table data.
- "${table.fromDateTime}": Start date and time of the table data.
- "${table.toDate}": End date of the table data.
- "${table.toDateTime}": End date and time of the table data.
- "${table.headers}": Table headers.
- "${table.data}": Table data.
If not provided, a default template will be used.
- pdfTemplate: (string)
Content of the FreeMarker template for customizing PDF report exports.
- csvTemplate: (string)
Content of the FreeMarker template for customizing CSV report exports.
- emailTemplate: required(object)
Notifies recipients that a report has been generated and is available for download.
- recipients: (array of string)
A list of email addresses of the recipients.
- subject: (string - default: Kaaiot Report)
The subject line of the email notification.
- template: (string)
The HTML content of the email notification. If not provided, a default template will be used.
Can include the following placeholders:
- "{{report_download_link}}": Link to download the report.
- "{{report_name}}": Name of the generated report.
- "{{year}}": Current year.
- recipients: (array of string)
Example:
{
"name": "Monthly Sensor Readings",
"reportName": "sensor__readings__{{createdDate}}",
"exportType": "PDF",
"exportTemplate": {
"pdfTemplate": "<html><head><table><thead><tr><#list table.headers as header><th>${header}</th></#list></tr></thead></table></#list></body></html>",
"csvTemplate": "${table.headers?join(\",\")}"
},
"emailTemplate": {
"subject": "Sensor Readings Report",
"template": "<html><body><p>{{report_name}}</p></body></html>",
"recipients": [
"example@kaaiot.io"
]
}
}HTTP status code 204
Template is successfully updated.
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Updates template execution state. When set to ACTIVE, all associated triggers will be enabled.
put /templates/{templateId}/state
Updates template execution state. When set to ACTIVE, all associated triggers will be enabled.
- template:update
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
Query Parameters
- type: required(one of ACTIVE, INACTIVE)
The execution state to set.
HTTP status code 204
Execution state successfully updated.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Updates triggers associated with this template. These trigger IDs define when the report should be generated.
put /templates/{templateId}/triggers
Updates triggers associated with this template. These trigger IDs define when the report should be generated.
- template:update
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
Body
Media type: application/json
Type: array of string
Example:
[
"aa3f7b8d-3a22-46e8-8803-e89480ff73f1"
]HTTP status code 204
Triggers successfully updated.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Allows uploading of an Excel template file to customize the layout and content for exporting reports in Excel format.
If not provided, default template will be used.
Placeholders for report data:
- "${reportName}": The name of the report.
- "${reportCreatedDate}": The creation date of the report.
- "${reportCreatedDateTime}": The creation date and time of the report.
Placeholders for each table:
- "${table.name}": Table name.
- "${table.description}": Table description.
- "${table.application}": Application name.
- "${table.fromDate}": Start date of the table data.
- "${table.fromDateTime}": Start date and time of the table data.
- "${table.toDate}": End date of the table data.
- "${table.toDateTime}": End date and time of the table data.
- "${table.headers}": Table headers.
- "${table.data}": Table data.
For a comprehensive guide on creating templates, visit the Template Generation Guide.
put /templates/{templateId}/excel/upload
Allows uploading of an Excel template file to customize the layout and content for exporting reports in Excel format.
If not provided, default template will be used.
Placeholders for report data:
- "${reportName}": The name of the report.
- "${reportCreatedDate}": The creation date of the report.
- "${reportCreatedDateTime}": The creation date and time of the report.
Placeholders for each table:
- "${table.name}": Table name.
- "${table.description}": Table description.
- "${table.application}": Application name.
- "${table.fromDate}": Start date of the table data.
- "${table.fromDateTime}": Start date and time of the table data.
- "${table.toDate}": End date of the table data.
- "${table.toDateTime}": End date and time of the table data.
- "${table.headers}": Table headers.
- "${table.data}": Table data.
For a comprehensive guide on creating templates, visit the Template Generation Guide.
- template:update
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
Body
Media type: application/x-www-form-urlencoded
Type: any
HTTP status code 204
The template was successfully uploaded.
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Downloads the Excel template file.
get /templates/{templateId}/excel/download
Downloads the Excel template file.
- template:read
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
HTTP status code 200
The template is successfully retrieved and prepared for download.
Headers
- Content-Disposition: required(string)
The filename of the downloaded Excel template.
Example:
attachment; filename="{templateId}-excel-template.xlsx"
Body
Media type: application/octet-stream
Type: any
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Creates a new item.
post /templates/{templateId}/tables
Creates a new item.
- template:table:create
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
Body
Media type: application/json
Type: object
Properties- name: required(string - pattern: ^.{1,30}$)
Table name.
- description: (string)
Description and notes for this table.
- orderIndex: (number)
Specifies the sequence or position of the table in the report.
- query: required(object)
The query used to retrieve data for the table.
- application: required(string)
Application name.
- timestampColumn: (string)
Elastic timestamp column name to search.
- from: required(string)
Specify the start of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - to: required(string)
Specify the end of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - dimensions: required(array of table.DimensionColumn)
List of columns that going to be used as group by queries dimensions.
Items: DimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the dimension's source value is absent, null, or empty string. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, missing/null/empty dimension values are replaced with
defaultValue. Defaults to false (existing behaviour preserved).
- name: (string)
- columns: required(array of table.AggregationColumn)
Specifies the aggregation columns.
Items: AggregationColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- function: required(one of SUM, AVG, MIN, MAX, COUNT, LAST)
Aggregation function to be applied.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the aggregation result is absent or null. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, null/absent aggregation results are replaced with
defaultValue. Additionally, when at least one aggregation column has this enabled, rows are created for dimension members (e.g. from metadata) that have no analytics data, with aggregation columns filled from their configured defaults. Defaults to false (existing behaviour preserved).
- name: (string)
- timeDimension: required(array of table.TimeHistDimensionColumn)
Time histogram component of the group by queries dimensions.
Items: TimeHistDimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- calendarInterval: required(string)
Calendar interval passed to the elasticsearch.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- name: (string)
- where: required(array of table.WhereColumn)
Filter conditions to be applied to the data.
Items: WhereColumn
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Column type.
- function: required(one of EQ, IN, LAST, IN_RANGE)
Filter function to be applied.
- value: required(object)
Value to be applied for filtering.
- from: required(string)
Used for filtering in the IN_RANGE function.
- to: required(string)
Used for filtering in the IN_RANGE function.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
- application: required(string)
Example:
{
"name": "Sensor humidity readings",
"description": "Sensor FMC-500",
"query": {
"dimensions": [
{
"source": "METADATA",
"path": "name",
"type": "STRING",
"useDefaultValue": true,
"defaultValue": "unknown"
},
{
"source": "TIME_SERIES",
"path": "endpointId",
"type": "NUMBER"
},
{
"source": "TIME_SERIES",
"name": "humidity",
"path": "auto~humidity",
"type": "NUMBER"
}
],
"application": "cnc5h752908c73fp4pd0",
"from": "now-1h",
"to": "now"
}
}HTTP status code 201
Item is successfully created.
Headers
- Location: required(string)
URI in format
{schema}://{host}/rs/api/v1/templates/{templateId}/tablesExample:
https://cloud.kaaiot.com/rs/api/v1/templates/47e17fc5-060c-4923-b315-d17f6a1bf8d6/tables/47e17fc5-060c-4923-b315-d17f6a1bf8d6
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Updates item.
Retrieves item.
Deletes.
put /templates/{templateId}/tables/{tableId}
Updates item.
- template:table:update
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
- tableId: required(string)
Table ID.
Body
Media type: application/json
Type: object
Properties- name: required(string - pattern: ^.{1,30}$)
Table name.
- description: (string)
Description and notes for this table.
- orderIndex: (number)
Specifies the sequence or position of the table in the report.
- query: required(object)
The query used to retrieve data for the table.
- application: required(string)
Application name.
- timestampColumn: (string)
Elastic timestamp column name to search.
- from: required(string)
Specify the start of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - to: required(string)
Specify the end of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - dimensions: required(array of table.DimensionColumn)
List of columns that going to be used as group by queries dimensions.
Items: DimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the dimension's source value is absent, null, or empty string. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, missing/null/empty dimension values are replaced with
defaultValue. Defaults to false (existing behaviour preserved).
- name: (string)
- columns: required(array of table.AggregationColumn)
Specifies the aggregation columns.
Items: AggregationColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- function: required(one of SUM, AVG, MIN, MAX, COUNT, LAST)
Aggregation function to be applied.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the aggregation result is absent or null. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, null/absent aggregation results are replaced with
defaultValue. Additionally, when at least one aggregation column has this enabled, rows are created for dimension members (e.g. from metadata) that have no analytics data, with aggregation columns filled from their configured defaults. Defaults to false (existing behaviour preserved).
- name: (string)
- timeDimension: required(array of table.TimeHistDimensionColumn)
Time histogram component of the group by queries dimensions.
Items: TimeHistDimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- calendarInterval: required(string)
Calendar interval passed to the elasticsearch.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- name: (string)
- where: required(array of table.WhereColumn)
Filter conditions to be applied to the data.
Items: WhereColumn
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Column type.
- function: required(one of EQ, IN, LAST, IN_RANGE)
Filter function to be applied.
- value: required(object)
Value to be applied for filtering.
- from: required(string)
Used for filtering in the IN_RANGE function.
- to: required(string)
Used for filtering in the IN_RANGE function.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
- application: required(string)
Example:
{
"name": "Sensor humidity readings",
"description": "Sensor FMC-500",
"query": {
"dimensions": [
{
"source": "METADATA",
"path": "name",
"type": "STRING",
"useDefaultValue": true,
"defaultValue": "unknown"
},
{
"source": "TIME_SERIES",
"path": "endpointId",
"type": "NUMBER"
},
{
"source": "TIME_SERIES",
"name": "humidity",
"path": "auto~humidity",
"type": "NUMBER"
}
],
"application": "cnc5h752908c73fp4pd0",
"from": "now-1h",
"to": "now"
}
}HTTP status code 204
Item is successfully updated.
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
get /templates/{templateId}/tables/{tableId}
Retrieves item.
- template:table:read
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
- tableId: required(string)
Table ID.
HTTP status code 200
Item is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- id: required(string)
Table ID.
- name: required(string)
Table name.
- description: (string)
Description and notes for this table.
- orderIndex: (number)
Specifies the sequence or position of the table in the report.
- query: required(object)
The query used to retrieve data for the table.
- application: required(string)
Application name.
- timestampColumn: (string)
Elastic timestamp column name to search.
- from: required(string)
Specify the start of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - to: required(string)
Specify the end of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - dimensions: required(array of table.DimensionColumn)
List of columns that going to be used as group by queries dimensions.
Items: DimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the dimension's source value is absent, null, or empty string. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, missing/null/empty dimension values are replaced with
defaultValue. Defaults to false (existing behaviour preserved).
- name: (string)
- columns: required(array of table.AggregationColumn)
Specifies the aggregation columns.
Items: AggregationColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- function: required(one of SUM, AVG, MIN, MAX, COUNT, LAST)
Aggregation function to be applied.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the aggregation result is absent or null. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, null/absent aggregation results are replaced with
defaultValue. Additionally, when at least one aggregation column has this enabled, rows are created for dimension members (e.g. from metadata) that have no analytics data, with aggregation columns filled from their configured defaults. Defaults to false (existing behaviour preserved).
- name: (string)
- timeDimension: required(array of table.TimeHistDimensionColumn)
Time histogram component of the group by queries dimensions.
Items: TimeHistDimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- calendarInterval: required(string)
Calendar interval passed to the elasticsearch.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- name: (string)
- where: required(array of table.WhereColumn)
Filter conditions to be applied to the data.
Items: WhereColumn
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Column type.
- function: required(one of EQ, IN, LAST, IN_RANGE)
Filter function to be applied.
- value: required(object)
Value to be applied for filtering.
- from: required(string)
Used for filtering in the IN_RANGE function.
- to: required(string)
Used for filtering in the IN_RANGE function.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
- application: required(string)
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was created.
Example:
2023-06-30T12:30:54.540Z - updatedAt: (datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated.
Example:
2023-06-30T12:30:54.540Z
Example:
{
"id": "768b5afe-2437-468b-b77b-1335b499f588",
"name": "Sensor humidity readings",
"description": "Sensor FMC-500",
"query": {
"dimensions": [
{
"source": "METADATA",
"path": "name",
"type": "STRING"
},
{
"source": "TIME_SERIES",
"path": "endpointId",
"type": "NUMBER"
},
{
"source": "TIME_SERIES",
"name": "humidity",
"path": "auto~humidity",
"type": "NUMBER"
}
],
"application": "cnc5h752908c73fp4pd0",
"from": "now-1M",
"to": "now"
},
"createdAt": "2024-02-20T17:00:00.000Z",
"updatedAt": "2024-02-20T17:00:00.000Z"
}HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
delete /templates/{templateId}/tables/{tableId}
Deletes.
- template:table:delete
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
- tableId: required(string)
Table ID.
HTTP status code 204
Item is successfully deleted.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Retrieves default email template and subject.
get /templates/default/email
Retrieves default email template and subject.
HTTP status code 200
Item is successfully retrieved.
Body
Media type: application/json
Type: any
Example:
{
"subject": "Kaaiot Report",
"template": "<html><body><div><p>Kaa Report</p><a href=\"{{report_download_link}}\"class=\"btn\">Download report</a></div></body></html>"
}Retrieves default pdf template and.
get /templates/default/pdf
Retrieves default pdf template and.
HTTP status code 200
Item is successfully retrieved.
Body
Media type: application/json
Type: any
Example:
{
"template": "<html><body><table><tbody><#list table.rows as row><tr><#list row as cell><td>${cell!}</td></#list></tr></#list></tbody></table></body></html>"
}Retrieves default csv template.
Downloads default Excel template file.
get /templates/default/excel
Downloads default Excel template file.
HTTP status code 200
The default template is successfully retrieved and prepared for download.
Headers
- Content-Disposition: required(string)
The filename of the downloaded Excel template.
Example:
attachment; filename="default-excel-template.xlsx"
Body
Media type: application/octet-stream
Type: any
Triggers
Operations on triggers.
Creates a new item.
Retrieves list.
post /triggers
Creates a new item.
- trigger:create
AM supports OAuth 2.0 for authenticating all API requests.
Body
Media type: application/json
Type: object
Properties- name: required(string)
Trigger name.
- type: required(CRON)
Specifies the type of trigger mechanism.
- description: (string)
Description and notes for this trigger.
- cronLine: required(string)
Quartz cron line.
- poolIds: (array of string)
An array of the unique identifiers of the pools to which the trigger should be attached.
Example:
{
"name": "Monthly Trigger",
"description": "On the last day of the month, every month",
"type": "CRON",
"cronLine": "0 0 0 L * ?",
"poolIds": [
"aXJuOnJjNzNkYmg3cTA6aWFtY29yZTo0YXRjaWNuaXNnOjpwb29sL2Rldg=="
]
}HTTP status code 201
Item is successfully created.
Headers
- Location: required(string)
URI in format
{schema}://{host}/rs/api/v1/triggers/{triggerId}Example:
https://cloud.kaaiot.com/rs/api/v1/triggers/47e17fc5-060c-4923-b315-d17f6a1bf8d6
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
get /triggers
Retrieves list.
- trigger:read
AM supports OAuth 2.0 for authenticating all API requests.
Query Parameters
- triggerId: (array of )
Trigger Ids.
- name: (string)
Trigger name. Supports partial match.
- page: (number - default: 0)
Page number.
Example:
0 - size: (number - default: 100)
Page size.
Example:
10 - sort: (one of createdAt, updatedAt - default: createdAt)
Field to sort by.
Example:
updatedAt - sortOrder: (one of asc, desc - default: desc)
Sort direction.
Example:
asc
HTTP status code 200
List is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- totalElements: required(integer)
Total number of elements available for retrieval.
- content: required(array of trigger.ItemResponse)
Items: ItemResponse
- id: required(string)
Trigger ID.
- tenantId: required(string)
Tenant ID.
- name: required(string)
Trigger name.
- description: (string)
Description and notes for this trigger.
- cronLine: required(string)
Quartz cron line
- type: required(CRON)
Specifies the type of trigger mechanism.
- poolIds: (array of string)
Pool IDs the trigger attached to.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was created.
- updatedAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated.
- id: required(string)
Example:
{
"totalElements": 1,
"content": [
{
"id": "aa3f7b8d-3a22-46e8-8803-e89480ff73f1",
"tenantId": "qs73c8ovqg",
"name": "Monthly Trigger",
"description": "On the last day of the month, every month",
"type": "CRON",
"cronLine": "0 0 0 L * ?",
"createdAt": "2024-04-26T15:48:00.889Z",
"updatedAt": "2024-04-26T15:48:00.889Z"
}
]
}HTTP status code 401
Request is not authenticated.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Updates item.
Retrieves item.
Deletes.
put /triggers/{triggerId}
Updates item.
- trigger:update
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- triggerId: required(string)
Trigger ID.
Body
Media type: application/json
Type: object
Properties- name: required(string)
Trigger name.
- type: required(CRON)
Specifies the type of trigger mechanism.
- description: (string)
Description and notes for this trigger.
- cronLine: required(string)
Quartz cron line.
Example:
{
"name": "Monthly Trigger",
"description": "On the last day of the month, every month",
"type": "CRON",
"cronLine": "0 0 0 L * ?"
}HTTP status code 204
Item is successfully updated.
HTTP status code 400
Invalid request.
Body
Media type: application/json
Type: object
Properties- message: required(string)
Detailed error description.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
get /triggers/{triggerId}
Retrieves item.
- trigger:read
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- triggerId: required(string)
Trigger ID.
HTTP status code 200
Item is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- id: required(string)
Trigger ID.
- tenantId: required(string)
Tenant ID.
- name: required(string)
Trigger name.
- description: (string)
Description and notes for this trigger.
- cronLine: required(string)
Quartz cron line
- type: required(CRON)
Specifies the type of trigger mechanism.
- poolIds: (array of string)
Pool IDs the trigger attached to.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was created.
- updatedAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated.
Example:
{
"id": "aa3f7b8d-3a22-46e8-8803-e89480ff73f1",
"tenantId": "qs73c8ovqg",
"name": "Monthly Trigger",
"description": "On the last day of the month, every month",
"type": "CRON",
"cronLine": "0 0 0 L * ?",
"poolIds": [
"aXJuOnJjNzNkYmg3cTA6aWFtY29yZTo0YXRjaWNuaXNnOjpwb29sL2Rldg=="
],
"createdAt": "2024-04-26T15:48:00.889Z",
"updatedAt": "2024-04-26T15:48:00.889Z"
}HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
delete /triggers/{triggerId}
Deletes.
- trigger:delete
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- triggerId: required(string)
Trigger ID.
HTTP status code 204
Item is successfully deleted.
HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Tasks
Operations on tasks.
Retrieves list.
get /tasks/status
Retrieves list.
- template:task:read
AM supports OAuth 2.0 for authenticating all API requests.
Query Parameters
- taskId: (array of )
Task IDs.
- templateId: (array of )
Template IDs.
- templateName: (array of )
Template name. Supports partial match.
- triggerId: (string)
Trigger ID.
- triggerName: (string)
Trigger name. Supports partial match.
- type: (one of IN_PROGRESS, DONE, FAILED)
Trigger type.
- page: (number - default: 0)
Page number.
Example:
0 - size: (number - default: 100)
Page size.
Example:
10 - sort: (one of createdAt, updatedAt - default: createdAt)
Field to sort by.
Example:
updatedAt - sortOrder: (one of asc, desc - default: desc)
Sort direction.
Example:
asc
HTTP status code 200
List is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- totalElements: required(integer)
Total number of elements available for retrieval.
- content: required(array of task.ItemResponse)
Items: ItemResponse
- id: required(string)
Task ID.
- templateId: (string)
Template ID for which a task has been created for execution.
- templateName: (string)
Template name.
- triggerId: (string)
Trigger ID that initiated template execution. If absent template executed manually.
- triggerName: (string)
Trigger name.
- reportId: (string)
ID of the report generated as a result of the task execution.
- status: required(one of IN_PROGRESS, DONE, FAILED)
The current state of the task.
- errorMassage: (string)
An error message to be populated if the task FAILED.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the task was created.
- startedAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the task was started.
- finishedAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the task was finished.
- id: required(string)
Example:
{
"totalElements": 2,
"content": [
{
"id": "3d419acb-f38e-416c-b47d-4230190df6c6",
"status": "DONE",
"templateId": "3d37097f-3258-4b16-b2e7-2e6df97a303b",
"templateName": "Monthly Sensor Readings",
"triggerId": "aa3f7b8d-3a22-46e8-8803-e89480ff73f1",
"triggerName": "Monthly Trigger",
"reportId": "d1466785-6498-4a7b-ae5b-b1bbc14986ff",
"createdAt": "2024-04-10T11:00:00.000Z",
"startedAt": "2024-04-10T11:00:10.000Z",
"finishedAt": "2024-04-10T11:00:20.000Z"
},
{
"id": "b1e42223-69ef-459f-8b9a-9b41b981284a",
"status": "FAILED",
"errorMessage": "Error sending notification",
"templateId": "3d37097f-3258-4b16-b2e7-2e6df97a303b",
"templateName": "Monthly Sensor Readings",
"createdAt": "2024-04-10T12:00:00.000Z",
"startedAt": "2024-04-10T12:00:10.000Z",
"finishedAt": "2024-04-10T12:00:20.000Z"
},
{
"id": "d0c36ba7-94ec-423d-bfdd-c8b2a807d5bc",
"status": "DONE",
"reportId": "8a7c2efd-d262-4733-a046-0c1ca46f4ed7",
"createdAt": "2024-04-10T13:00:00.000Z",
"startedAt": "2024-04-10T13:00:10.000Z",
"finishedAt": "2024-04-10T13:00:20.000Z"
}
]
}HTTP status code 401
Request is not authenticated.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Execute template.
post /tasks/templates
Execute template.
- template:task:create
AM supports OAuth 2.0 for authenticating all API requests.
Body
Media type: application/json
Type: object
Properties- reportName: required(string)
The name of the report to be generated.
Can include the following placeholders:
- "{{createdDate}}"
- "{{createdDateTime}}"
- "{{fromDate}}"
- "{{fromDateTime}}"
- "{{toDate}}"
- "{{toDateTime}}"
Example:
Report_Name_{{createdDate}} - exportType: (one of CSV_IN_ZIP, PDF, EXCEL - default: CSV_IN_ZIP)
The format of the report in which the notification will be sent.
- exportTemplate: (object)
Offers customization options to define the layout and content of report exports.
Placeholders for report data:
- "${reportName}": The name of the report.
- "${reportCreatedDate}": The creation date of the report.
- "${reportCreatedDateTime}": The creation date and time of the report.
Placeholders for each table:
- "${table.name}": Table name.
- "${table.description}": Table description.
- "${table.application}": Application name.
- "${table.fromDate}": Start date of the table data.
- "${table.fromDateTime}": Start date and time of the table data.
- "${table.toDate}": End date of the table data.
- "${table.toDateTime}": End date and time of the table data.
- "${table.headers}": Table headers.
- "${table.data}": Table data.
If not provided, a default template will be used.
- pdfTemplate: (string)
Content of the FreeMarker template for customizing PDF report exports.
- csvTemplate: (string)
Content of the FreeMarker template for customizing CSV report exports.
- emailTemplate: (object)
Notifies recipients that a report has been generated and is available for download.
- recipients: (array of string)
A list of email addresses of the recipients.
- subject: (string - default: Kaaiot Report)
The subject line of the email notification.
- template: (string)
The HTML content of the email notification. If not provided, a default template will be used.
Can include the following placeholders:
- "{{report_download_link}}": Link to download the report.
- "{{report_name}}": Name of the generated report.
- "{{year}}": Current year.
- recipients: (array of string)
- tables: required(array of table.UpsertRequest)
List of table templates.
Items: UpsertRequest
- name: required(string - pattern: ^.{1,30}$)
Table name.
- description: (string)
Description and notes for this table.
- orderIndex: (number)
Specifies the sequence or position of the table in the report.
- query: required(object)
The query used to retrieve data for the table.
- application: required(string)
Application name.
- timestampColumn: (string)
Elastic timestamp column name to search.
- from: required(string)
Specify the start of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - to: required(string)
Specify the end of the time window using date expressions (e.g.,
now,now-1h) or a specific timestamp in ISO 8601 format. - dimensions: required(array of table.DimensionColumn)
List of columns that going to be used as group by queries dimensions.
Items: DimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the dimension's source value is absent, null, or empty string. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, missing/null/empty dimension values are replaced with
defaultValue. Defaults to false (existing behaviour preserved).
- name: (string)
- columns: required(array of table.AggregationColumn)
Specifies the aggregation columns.
Items: AggregationColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- function: required(one of SUM, AVG, MIN, MAX, COUNT, LAST)
Aggregation function to be applied.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- defaultValue: (any)
Value substituted when the aggregation result is absent or null. Must be consistent with
type(NUMBER -> number, BOOL -> boolean, DATE -> ISO-8601 string, STRING -> string). Only applied whenuseDefaultValueis true. - useDefaultValue: (boolean)
When true, null/absent aggregation results are replaced with
defaultValue. Additionally, when at least one aggregation column has this enabled, rows are created for dimension members (e.g. from metadata) that have no analytics data, with aggregation columns filled from their configured defaults. Defaults to false (existing behaviour preserved).
- name: (string)
- timeDimension: required(array of table.TimeHistDimensionColumn)
Time histogram component of the group by queries dimensions.
Items: TimeHistDimensionColumn
- name: (string)
Column display name. Path defaults to column name if not provided.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Expected column type.
- calendarInterval: required(string)
Calendar interval passed to the elasticsearch.
- expression: (string)
A Mustache expression used to transform or format a column value. The expression is applied per row and replaces the column's existing value with the expression result. Any other column in the same row can be referenced by name (e.g.
{{speed}}), and the built-in lambdas below can be applied as Mustache sections. Lambdas may be nested, and column references / lambdas inside another lambda's body are resolved before the outer lambda is applied.Built-in lambdas:
{{column}}Raw value of the referenced column.{{#round}}{{column}}{{/round}}Round down to 0 decimal places.{{#round1}}{{column}}{{/round1}}Round down to 1 decimal place.{{#round2}}{{column}}{{/round2}}Round down to 2 decimal places.{{#dateTime}}{{column}}{{/dateTime}}Format an epoch-millis or ISO timestamp asd MMM yyyy HH:mm.{{#dateOnly}}{{column}}{{/dateOnly}}Format an epoch-millis or ISO timestamp asdd MMM yyyy.{{#timeOnly}}{{column}}{{/timeOnly}}Format an epoch-millis or ISO timestamp asHH:mm:ss.{{#iff}}{{column}}|trueText|falseText{{/iff}}Conditional (ternary) expression. RenderstrueTextwhen the value is truthy, otherwisefalseText. Falsy values: empty,0,0.0, any numeric zero,false,null(case-insensitive). All other values are truthy. Whitespace around each of the three parts is trimmed; the false branch may be omitted ({{column}}|trueText|) and renders as empty. Pipe characters inside the branch text are preserved.Note: an expression is only applied when the column has a present, non-null value in the row. For aggregation columns that may yield null (for example AVG over documents missing the field), set
useDefaultValuetogether withdefaultValueon the column so the expression is evaluated on every row.Example:
{{column}} km/h {{#dateTime}}{{column}}{{/dateTime}} {{#dateOnly}}{{column}}{{/dateOnly}} {{#timeOnly}}{{column}}{{/timeOnly}} {{#round}}{{column}}{{/round}} {{#round1}}{{column}}{{/round1}} {{#round2}}{{column}}{{/round2}} {{#iff}}{{column}}|Active|Inactive{{/iff}} - orderIndex: (number)
Specifies the sequence or position of the column in the table.
- name: (string)
- where: required(array of table.WhereColumn)
Filter conditions to be applied to the data.
Items: WhereColumn
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
Origin from which this column will be queried.
- path: required(string)
Path for the target metric in the datasource.
- type: required(one of STRING, NUMBER, DATE, BOOL)
Column type.
- function: required(one of EQ, IN, LAST, IN_RANGE)
Filter function to be applied.
- value: required(object)
Value to be applied for filtering.
- from: required(string)
Used for filtering in the IN_RANGE function.
- to: required(string)
Used for filtering in the IN_RANGE function.
- source: required(one of ANALYTICS, METADATA, ASSETS, TIME_SERIES)
- application: required(string)
- name: required(string - pattern: ^.{1,30}$)
Example:
{
"reportName": "sensor__readings__{{createdDate}}",
"exportType": "PDF",
"exportTemplate": {
"pdfTemplate": "<html><head><table><thead><tr><#list table.headers as header><th>${header}</th></#list></tr></thead></table></#list></body></html>",
"csvTemplate": "${table.headers?join(\",\")}"
},
"emailTemplate": {
"subject": "Sensor Readings Report",
"template": "<html><body><p>{{report_name}}</p></body></html>",
"recipients": [
"example@kaaiot.io"
]
},
"tables": [
{
"name": "Sensor humidity readings",
"description": "Sensor FMC-500",
"query": {
"dimensions": [
{
"source": "METADATA",
"path": "name",
"type": "STRING"
},
{
"source": "TIME_SERIES",
"path": "endpointId",
"type": "NUMBER"
},
{
"source": "TIME_SERIES",
"name": "humidity",
"path": "auto~humidity",
"type": "NUMBER"
}
],
"application": "cnc5h752908c73fp4pd0",
"from": "now-1M",
"to": "now"
}
}
]
}HTTP status code 202
Template execution task is accepted.
Body
Media type: application/json
Type: object
Properties- taskId: required(string)
Template execution task ID.
Example:
{
"taskId":"3d419acb-f38e-416c-b47d-4230190df6c6"
}HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Execute template.
post /tasks/templates/{templateId}
Execute template.
- template:task:create
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- templateId: required(string)
Template ID.
HTTP status code 202
Template execution task is accepted.
Body
Media type: application/json
Type: object
Properties- taskId: required(string)
Template execution task ID.
Example:
{
"taskId":"3d419acb-f38e-416c-b47d-4230190df6c6"
}HTTP status code 401
Request is not authenticated.
HTTP status code 403
Principal does not have sufficient permissions to perform this operation.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Reports
Operations on reports.
Returns reports that match query parameters.
get /reports
Returns reports that match query parameters.
- report:read
AM supports OAuth 2.0 for authenticating all API requests.
Query Parameters
- reportId: (string)
Report identifier, can be one or multiple.
Example:
d1466785-6498-4a7b-ae5b-b1bbc14986ff - templateId: (string)
Template identifier, can be one or multiple.
Example:
4a2ab67a-b5d7-4919-96e0-127d7d558e5a - name: (string)
Report name. Supports partial match.
Example:
Monitoring - page: (number - default: 0)
Page number.
Example:
0 - size: (number - default: 100)
Page size.
Example:
10 - sort: (one of createdAt, updatedAt - default: createdAt)
Field to sort by.
Example:
updatedAt - sortOrder: (one of asc, desc - default: desc)
Sort direction.
Example:
asc
HTTP status code 200
Reports are successfully retrieved.
Body
Media type: application/json
Type: object
Properties- totalElements: required(integer)
Total number of elements available for retrieval.
- content: required(array of report.ItemResponse)
Items: ItemResponse
- id: required(string)
Report ID.
- name: required(string)
Report name.
- templateId: (string)
The identifier of the template used to generate the report.
- poolIds: (array of string)
Pool IDs the report attached to.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the report was generated.
- id: required(string)
Example:
{
"content": [
{
"id": "d1466785-6498-4a7b-ae5b-b1bbc14986ff",
"name": "Sensor Readings Report",
"templateId": "3d37097f-3258-4b16-b2e7-2e6df97a303b",
"createdAt": "2024-04-26T15:00:00.000Z"
},
{
"id": "118bed3b-2d2d-4502-8f25-6d2b78227ac1",
"name": "Sensor Readings Report",
"templateId": "177d15c7-74c4-4649-b262-d578ab29ddb9",
"createdAt": "2024-03-20T15:00:00.000Z"
}
],
"totalElements": 2
}HTTP status code 401
Request is not authenticated.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Retrieves report.
get /reports/{reportId}
Retrieves report.
- report:read
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- reportId: required(string)
Identifier of the report to operate on.
Example:
d1466785-6498-4a7b-ae5b-b1bbc14986ff
HTTP status code 200
Report is successfully retrieved.
Body
Media type: application/json
Type: object
Properties- id: required(string)
Report ID.
- name: required(string)
Report name.
- templateId: (string)
The identifier of the template used to generate the report.
- createdAt: required(datetime)
Timestamp in ISO 8601 format (UTC timezone) showing when the report was generated.
- tables: required(array of report.ItemTable)
A list of tables containing the data for the report.
Items: ItemTable
- name: required(string)
Table name.
- application: required(string)
The name of the application associated with the report table.
- description: (string)
Notes or context about this report table.
- from: required(string)
The starting timestamp for the data included in the report table.
- to: required(string)
The ending timestamp for the data included in the report table.
- headers: required(array of string)
List of column headers for the report table.
- data: required(object)
The data contained within the report table.
- name: required(string)
Example:
{
"id": "d1466785-6498-4a7b-ae5b-b1bbc14986ff",
"name": "Sensor Readings Report",
"templateId": "3d37097f-3258-4b16-b2e7-2e6df97a303b",
"createdAt": "2024-04-26T15:00:00.000Z",
"tables": [
{
"name": "Sensor humidity readings",
"description": "Sensor FMC-500",
"application": "cnc5h752908c73fp4pd0",
"from": "2024-03-26T15:00:00.000Z",
"to": "2024-04-26T15:00:00.000Z",
"headers": [
"name",
"endpointId",
"humidity"
],
"data": [
{
"name": "FMC-500",
"endpointId": "568b5afe-2437-468b-b57b-1335b499f589",
"humidity": "73"
},
{
"name": "FMC-500",
"endpointId": "568b5afe-2437-468b-b57b-1335b499f589",
"humidity": "75"
}
]
}
],
"poolIds": [
"aXJuOnJjNzNkYmg3cTA6aWFtY29yZTo0YXRjaWNuaXNnOjpwb29sL2Rldg=="
]
}HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.
Retrieves link to download the report.
get /reports/{reportId}/download
Retrieves link to download the report.
- report:read
AM supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- reportId: required(string)
Identifier of the report to operate on.
Example:
d1466785-6498-4a7b-ae5b-b1bbc14986ff
Query Parameters
- exportType: required(one of CSV_IN_ZIP, PDF, EXCEL)
Report export type.
HTTP status code 200
Link successfully retrieved.
Body
Media type: application/json
Type: object
Properties- downloadLink: required(string)
Link to download report.
Example:
{
"downloadLink": "https://minio.cloud.kaaiot.com/{tenantId}/reports/{templateId}/{reportId}/{reportName}.pdf"
}HTTP status code 401
Request is not authenticated.
HTTP status code 404
Resource not found or querying user is not authorized for it.
Secured by oauth_2_0
Headers
- Authorization: (string)
Used to send a valid OAuth 2 access token. Example: "Authorization: Bearer 'access_token'" where 'access_token' must be replaced by a valid OAuth access token. This header is needed only if API authentication is enabled for the service.