{ruleID}/data

Location /api/apps/{appID}/analytics/{ruleID}/data

Request Headers (Applies to all methods)

Authorization
header
Required: Yes

GET

/api/apps/{appID}/analytics/{ruleID}/data

Description

Retrieve analytics result in grouped format.

This format is used when the media type is */*, application/json, or unspecified.

Content-Type application/json

Headers
Name Required? type Description
Authorization Yes string Authorization can be of type Basic or Bearer.
  • Authorization Basic: header for granting an anonymous access.
    • Set a Base64-encoded string of AppID and AppKey concatenated with a colon (APP_ID:APP_KEY).
    • The header should look like:
      Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3
  • Authorization Bearer: using Oauth2 Bearer Token.
    • The header should look like:
      Authorization: Bearer ht5fpHQAyrPPwLftK1rAqllv5WNVPCnYfPiCvPocFuQ
Accept No string application/vnd.kii.GroupedAnalyticResult+json or application/json
Params
Name Required? Type Description
group No string The group used for aggregating the result. The value must match with one of the column names specified in the associated rule. If no group is provided, the result data will be reaggregated with the group name DEFAULT.
startDate No DateParamType The start date of the result to fetch. The value is used for filtering the result set. The data format is YYYY-MM-DD.
This parameter works in pair with the 'endDate' parameter. You will get the validation error if one of them is missing.
endDate No DateParamType The end date of the result to fetch. The value is used for filtering the result set. The data format is YYYY-MM-DD.
This parameter works in pair with the 'startDate' parameter. You will get the validation error if one of them is missing.
filterN.name No string The name of the column to apply for filtering the result. The specified column name must match with one of the column names set in the designated rule.
"N" in the parameter name is an arbitrary integer number, so the actual parameter name will be like 'filter001.name'. This parameter works in pair with the 'filterN.value' parameter (e.g., the parameter 'filter001.name' works in pair with the parameter 'filter001.value'). You will get the validation error if one of them is missing.
If you set multiple pairs of 'filterN.name'/'filterN.value', the specified filters will be combined with AND operator
filterN.value No string The value of the column to apply for filtering the result.
"N" in the parameter name is an arbitrary integer number, so the actual parameter name will be like 'filter001.value'. This parameter works in pair with the 'filterN.name' parameter (e.g., the parameter 'filter001.value' works in pair with the parameter 'filter001.name'). You will get the validation error if one of them is missing.
If you set multiple pairs of 'filterN.name'/'filterN.value', the specified filters will be combined with AND operator.
cumulative No string Specify if you want to get the cumulative result or not. If the value is "true", you will get the cumulative result. If the value is "false" or no value is set, you will get the daily result.
Responses
200

Content-Type application/vnd.kii.GroupedAnalyticResult+json

Analytics result in grouped format
Contents
Name Type Description
snapshots GroupedSnapshots
name string Group name. If no group was specified, name is DEFAULT
data anySimpleType Analytics data
pointStart long Data point start timestamp
pointInterval long Data sampling interval
400

Content-Type application/vnd.kii.ValidationException+json

User data has validation errors
Contents
Name Type Description
errorCode string Error code "INVALID_INPUT_DATA".
message string The error message.
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

The request was not authorized.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).

GET

/api/apps/{appID}/analytics/{ruleID}/data

Description

Retrieve analytics result in tabular format

Content-Type application/json

Headers
Name Required? type Description
Authorization Yes string Authorization can be of type Basic or Bearer.
  • Authorization Basic: header for granting an anonymous access.
    • Set a Base64-encoded string of AppID and AppKey concatenated with a colon (APP_ID:APP_KEY).
    • The header should look like:
      Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3
  • Authorization Bearer: using Oauth2 Bearer Token.
    • The header should look like:
      Authorization: Bearer ht5fpHQAyrPPwLftK1rAqllv5WNVPCnYfPiCvPocFuQ
Accept Yes string application/vnd.kii.TabularAnalyticResult+json
Params
Name Required? Type Description
group No string The group used for aggregating the result. The value must match with one of the column names specified in the associated rule. If no group is provided, the result data will be reaggregated with the group name DEFAULT.
startDate No DateParamType The start date of the result to fetch. The value is used for filtering the result set. The data format is YYYY-MM-DD.
This parameter works in pair with the 'endDate' parameter. You will get the validation error if one of them is missing.
endDate No DateParamType The end date of the result to fetch. The value is used for filtering the result set. The data format is YYYY-MM-DD.
This parameter works in pair with the 'startDate' parameter. You will get the validation error if one of them is missing.
filterN.name No string The name of the column to apply for filtering the result. The specified column name must match with one of the column names set in the designated rule.
"N" in the parameter name is an arbitrary integer number, so the actual parameter name will be like 'filter001.name'. This parameter works in pair with the 'filterN.value' parameter (e.g., the parameter 'filter001.name' works in pair with the parameter 'filter001.value'). You will get the validation error if one of them is missing.
If you set multiple pairs of 'filterN.name'/'filterN.value', the specified filters will be combined with AND operator
filterN.value No string The value of the column to apply for filtering the result.
"N" in the parameter name is an arbitrary integer number, so the actual parameter name will be like 'filter001.value'. This parameter works in pair with the 'filterN.name' parameter (e.g., the parameter 'filter001.value' works in pair with the parameter 'filter001.name'). You will get the validation error if one of them is missing.
If you set multiple pairs of 'filterN.name'/'filterN.value', the specified filters will be combined with AND operator.
Responses
200

Content-Type application/vnd.kii.TabularAnalyticResult+json

Analytics result in tabular format
Contents
Name Type Description
labels Labels Data column labels.
label string Label for the data column
type LabelType
snapshots Snapshots
createdAt long Data creation timestamp
data Data Analytics data
400

Content-Type application/vnd.kii.ValidationException+json

User data has validation errors
Contents
Name Type Description
errorCode string Error code "INVALID_INPUT_DATA".
message string The error message.
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

The request was not authorized.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).