Query - Execute

Executes Time Series Query in pages of results - Get Events, Get Series or Aggregate Series.

POST https://{environmentFqdn}/timeseries/query?api-version=2020-07-31
POST https://{environmentFqdn}/timeseries/query?api-version=2020-07-31&storeType={storeType}

URI Parameters

Name In Required Type Description
environmentFqdn
path True

string

Per environment FQDN, for example 10000000-0000-0000-0000-100000000109.env.timeseries.azure.com. You can obtain this domain name from the response of the Get Environments API, Azure portal, or Azure Resource Manager.

api-version
query True

string

Version of the API to be used with the client request. Currently supported version is "2020-07-31".

storeType
query

string

For the environments with warm store enabled, the query can be executed either on the 'WarmStore' or 'ColdStore'. This parameter in the query defines which store the query should be executed on. If not defined, the query will be executed on the cold store.

Request Header

Name Required Type Description
x-ms-continuation

string

Continuation token from previous page of results to retrieve the next page of the results in calls that support pagination. To get the first page results, specify null continuation token as parameter value. Returned continuation token is null if all results have been returned, and there is no next page of results.

x-ms-client-request-id

string

Optional client request ID. Service records this value. Allows the service to trace operation across services, and allows the customer to contact support regarding a particular request.

x-ms-client-session-id

string

Optional client session ID. Service records this value. Allows the service to trace a group of related operations across services, and allows the customer to contact support regarding a particular group of requests.

Request Body

Name Type Description
aggregateSeries

AggregateSeries

Aggregate Series query. Allows to calculate an aggregated time series from events for a given Time Series ID and search span.

getEvents

GetEvents

Get Events query. Allows to retrieve raw events for a given Time Series ID and search span.

getSeries

GetSeries

Get Series query. Allows to retrieve time series of calculated variable values from events for a given Time Series ID and search span.

Responses

Name Type Description
200 OK

QueryResultPage

Successful query.

Headers

x-ms-request-id: string

Other Status Codes

TsiError

Unexpected error.

Headers

x-ms-request-id: string

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

ColdStoreQueryAggregateSeriesPage1
ColdStoreQueryAggregateSeriesPage2
ColdStoreQueryGetEventsPage1
ColdStoreQueryGetEventsPage2
ColdStoreQueryGetEventsPage3
ColdStoreQueryGetEventsPage4
ColdStoreQueryGetSeriesPage1
ColdStoreQueryGetSeriesPage2
ColdStoreQueryGetSeriesPage3
QueryAggregateSeriesPage1
QueryAggregateSeriesPage2
QueryAggregateSeriesWithCategoricalInterpolatedVariable
QueryAggregateSeriesWithCategoricalVariable
QueryAggregateSeriesWithSampleInterpolation
QueryGetEventsPage1
QueryGetEventsPage2
QueryGetEventsPage3
QueryGetEventsPage4
QueryGetEventsWithTakePage1
QueryGetEventsWithTakePage2
QueryGetSeriesPage1
QueryGetSeriesPage2
QueryGetSeriesPage3
QueryGetSeriesWithTakePage1
QueryGetSeriesWithTakePage2
WarmStoreQueryAggregateSeriesPage
WarmStoreQueryGetEventsPage1
WarmStoreQueryGetEventsPage2
WarmStoreQueryGetEventsPage3
WarmStoreQueryGetEventsPage4
WarmStoreQueryGetSeriesPage1
WarmStoreQueryGetSeriesPage2
WarmStoreQueryGetSeriesPage3

ColdStoreQueryAggregateSeriesPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "aggregateSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "interval": "PT1M",
    "inlineVariables": {
      "Count": {
        "kind": "aggregate",
        "filter": null,
        "aggregation": {
          "tsx": "count()"
        }
      },
      "MinTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "min($value)"
        }
      },
      "MaxTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "max($value)"
        }
      }
    },
    "projectedVariables": [
      "Count",
      "MinTemperature",
      "MaxTemperature"
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

ColdStoreQueryAggregateSeriesPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "aggregateSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "interval": "PT1M",
    "inlineVariables": {
      "Count": {
        "kind": "aggregate",
        "filter": null,
        "aggregation": {
          "tsx": "count()"
        }
      },
      "MinTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "min($value)"
        }
      },
      "MaxTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "max($value)"
        }
      }
    },
    "projectedVariables": [
      "Count",
      "MinTemperature",
      "MaxTemperature"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:00Z",
    "2016-08-01T00:01:00Z",
    "2016-08-01T00:02:00Z",
    "2016-08-01T00:03:00Z",
    "2016-08-01T00:04:00Z",
    "2016-08-01T00:05:00Z",
    "2016-08-01T00:06:00Z",
    "2016-08-01T00:07:00Z",
    "2016-08-01T00:08:00Z",
    "2016-08-01T00:09:00Z",
    "2016-08-01T00:10:00Z"
  ],
  "properties": [
    {
      "name": "Count",
      "type": "Long",
      "values": [
        50,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        null
      ]
    },
    {
      "name": "AverageTemperature",
      "type": "Double",
      "values": [
        71.25,
        85,
        82.5,
        80,
        89.16666666666667,
        75,
        90,
        75.83333333333333,
        85,
        82.5,
        null
      ]
    },
    {
      "name": "MinTemperature",
      "type": "Double",
      "values": [
        65.125,
        77.625,
        65.125,
        72.625,
        65.125,
        67.625,
        82.625,
        65.125,
        77.625,
        65.125,
        null
      ]
    },
    {
      "name": "MaxTemperature",
      "type": "Double",
      "values": [
        77.375,
        92.375,
        99.875,
        87.375,
        99.875,
        82.375,
        97.375,
        99.875,
        92.375,
        99.875,
        null
      ]
    }
  ],
  "progress": 100
}

ColdStoreQueryGetEventsPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

ColdStoreQueryGetEventsPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAxYZwidGFrZSI6MTAwMH0="
}

ColdStoreQueryGetEventsPage3

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        67.575
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAbCDewidGFrZSI6MTAwMH0="
}

ColdStoreQueryGetEventsPage4

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [],
  "properties": [],
  "progress": 100
}

ColdStoreQueryGetSeriesPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

ColdStoreQueryGetSeriesPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z",
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375,
        67.625
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAxYZwidGFrZSI6MTAwMH0="
}

ColdStoreQueryGetSeriesPage3

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=coldstore

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:21Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        67.825
      ]
    }
  ],
  "progress": 100
}

QueryAggregateSeriesPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "aggregateSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "interval": "PT1M",
    "inlineVariables": {
      "Count": {
        "kind": "aggregate",
        "filter": null,
        "aggregation": {
          "tsx": "count()"
        }
      },
      "MinTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "min($value)"
        }
      },
      "MaxTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "max($value)"
        }
      }
    },
    "projectedVariables": [
      "Count",
      "MinTemperature",
      "MaxTemperature"
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

QueryAggregateSeriesPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "aggregateSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "interval": "PT1M",
    "inlineVariables": {
      "Count": {
        "kind": "aggregate",
        "filter": null,
        "aggregation": {
          "tsx": "count()"
        }
      },
      "MinTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "min($value)"
        }
      },
      "MaxTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "max($value)"
        }
      }
    },
    "projectedVariables": [
      "Count",
      "MinTemperature",
      "MaxTemperature"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:00Z",
    "2016-08-01T00:01:00Z",
    "2016-08-01T00:02:00Z",
    "2016-08-01T00:03:00Z",
    "2016-08-01T00:04:00Z",
    "2016-08-01T00:05:00Z",
    "2016-08-01T00:06:00Z",
    "2016-08-01T00:07:00Z",
    "2016-08-01T00:08:00Z",
    "2016-08-01T00:09:00Z",
    "2016-08-01T00:10:00Z"
  ],
  "properties": [
    {
      "name": "Count",
      "type": "Long",
      "values": [
        50,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        null
      ]
    },
    {
      "name": "AverageTemperature",
      "type": "Double",
      "values": [
        71.25,
        85,
        82.5,
        80,
        89.16666666666667,
        75,
        90,
        75.83333333333333,
        85,
        82.5,
        null
      ]
    },
    {
      "name": "MinTemperature",
      "type": "Double",
      "values": [
        65.125,
        77.625,
        65.125,
        72.625,
        65.125,
        67.625,
        82.625,
        65.125,
        77.625,
        65.125,
        null
      ]
    },
    {
      "name": "MaxTemperature",
      "type": "Double",
      "values": [
        77.375,
        92.375,
        99.875,
        87.375,
        99.875,
        82.375,
        97.375,
        99.875,
        92.375,
        99.875,
        null
      ]
    }
  ],
  "progress": 100
}

QueryAggregateSeriesWithCategoricalInterpolatedVariable

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "aggregateSeries": {
    "searchSpan": {
      "from": "2019-10-10T23:41:04.021Z",
      "to": "2019-10-10T23:42:22.846Z"
    },
    "timeSeriesId": [
      "Sensor_58"
    ],
    "interval": "PT2S",
    "inlineVariables": {
      "Status_String": {
        "kind": "categorical",
        "value": {
          "tsx": "$event.[Status].String"
        },
        "interpolation": {
          "kind": "Step",
          "boundary": {
            "span": "PT5S"
          }
        },
        "categories": [
          {
            "label": "Good",
            "values": [
              "Good",
              "Very Good",
              "Excellent"
            ]
          },
          {
            "label": "Bad",
            "values": [
              "Bad",
              "OK"
            ]
          },
          {
            "label": "Other",
            "values": [
              "Other"
            ]
          }
        ],
        "defaultCategory": {
          "label": "Unknown"
        }
      },
      "Status_Long": {
        "kind": "categorical",
        "value": {
          "tsx": "tolong($event.[Status].Double)"
        },
        "interpolation": {
          "kind": "Step",
          "boundary": {
            "span": "PT5S"
          }
        },
        "categories": [
          {
            "label": "Good",
            "values": [
              0,
              1,
              2
            ]
          },
          {
            "label": "Bad",
            "values": [
              3,
              4
            ]
          },
          {
            "label": "Other",
            "values": [
              5
            ]
          }
        ],
        "defaultCategory": {
          "label": "Unknown"
        }
      }
    },
    "projectedVariables": [
      "Status_String",
      "Status_Long"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2019-10-10T23:41:04Z",
    "2019-10-10T23:41:06Z",
    "2019-10-10T23:41:08Z",
    "2019-10-10T23:41:10Z",
    "2019-10-10T23:41:12Z",
    "2019-10-10T23:41:14Z",
    "2019-10-10T23:41:16Z",
    "2019-10-10T23:41:18Z",
    "2019-10-10T23:41:20Z",
    "2019-10-10T23:41:22Z"
  ],
  "properties": [
    {
      "values": [
        0.203,
        0.141,
        0.268,
        0.398,
        0.402,
        0.047,
        0.1245,
        0.75,
        0.206,
        0.2635
      ],
      "name": "Status_String[Good]",
      "type": "Double"
    },
    {
      "values": [
        0.266,
        0.1955,
        0.242,
        0.148,
        0.25,
        0.055,
        0.6295,
        0.109,
        0.41,
        0.2125
      ],
      "name": "Status_String[Bad]",
      "type": "Double"
    },
    {
      "values": [
        0.5205,
        0.6635,
        0.49,
        0.454,
        0.348,
        0.898,
        0.246,
        0.141,
        0.384,
        0.524
      ],
      "name": "Status_String[Other]",
      "type": "Double"
    },
    {
      "values": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ],
      "name": "Status_String[Unknown]",
      "type": "Double"
    },
    {
      "values": [
        0.203,
        0.141,
        0.268,
        0.398,
        0.402,
        0.047,
        0.1245,
        0.75,
        0.206,
        0.2635
      ],
      "name": "Status_Long[Good]",
      "type": "Double"
    },
    {
      "values": [
        0.266,
        0.1955,
        0.242,
        0.148,
        0.25,
        0.055,
        0.6295,
        0.109,
        0.41,
        0.2125
      ],
      "name": "Status_Long[Bad]",
      "type": "Double"
    },
    {
      "values": [
        0.5205,
        0.6635,
        0.49,
        0.454,
        0.348,
        0.898,
        0.246,
        0.141,
        0.384,
        0.524
      ],
      "name": "Status_Long[Other]",
      "type": "Double"
    },
    {
      "values": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ],
      "name": "Status_Long[Unknown]",
      "type": "Double"
    }
  ],
  "progress": 100
}

QueryAggregateSeriesWithCategoricalVariable

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "aggregateSeries": {
    "searchSpan": {
      "from": "2019-10-10T23:42:00.000Z",
      "to": "2019-10-10T23:42:20.000Z"
    },
    "timeSeriesId": [
      "Sensor_58"
    ],
    "interval": "PT2S",
    "inlineVariables": {
      "Status_String": {
        "kind": "categorical",
        "value": {
          "tsx": "$event.[Status].String"
        },
        "categories": [
          {
            "label": "Good",
            "values": [
              "Good",
              "Very Good",
              "Excellent"
            ]
          },
          {
            "label": "Bad",
            "values": [
              "Bad",
              "OK"
            ]
          },
          {
            "label": "Other",
            "values": [
              "Other"
            ]
          }
        ],
        "defaultCategory": {
          "label": "Unknown"
        }
      },
      "Status_Long": {
        "kind": "categorical",
        "value": {
          "tsx": "tolong($event.[Status].Double)"
        },
        "categories": [
          {
            "label": "Good",
            "values": [
              0,
              1,
              2
            ]
          },
          {
            "label": "Bad",
            "values": [
              3,
              4
            ]
          },
          {
            "label": "Other",
            "values": [
              5
            ]
          }
        ],
        "defaultCategory": {
          "label": "Unknown"
        }
      }
    },
    "projectedVariables": [
      "Status_String",
      "Status_Long"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2019-10-10T23:42:00Z",
    "2019-10-10T23:42:02Z",
    "2019-10-10T23:42:04Z",
    "2019-10-10T23:42:06Z",
    "2019-10-10T23:42:08Z",
    "2019-10-10T23:42:10Z",
    "2019-10-10T23:42:12Z",
    "2019-10-10T23:42:14Z",
    "2019-10-10T23:42:16Z",
    "2019-10-10T23:42:18Z"
  ],
  "properties": [
    {
      "values": [
        5,
        8,
        4,
        6,
        9,
        8,
        3,
        6,
        5,
        8
      ],
      "name": "Status_String[Good]",
      "type": "Long"
    },
    {
      "values": [
        4,
        3,
        3,
        5,
        5,
        3,
        9,
        7,
        7,
        7
      ],
      "name": "Status_String[Bad]",
      "type": "Long"
    },
    {
      "values": [
        11,
        9,
        13,
        9,
        6,
        9,
        8,
        7,
        8,
        5
      ],
      "name": "Status_String[Other]",
      "type": "Long"
    },
    {
      "values": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ],
      "name": "Status_String[Unknown]",
      "type": "Long"
    },
    {
      "values": [
        5,
        8,
        4,
        6,
        9,
        8,
        3,
        6,
        5,
        8
      ],
      "name": "Status_Long[Good]",
      "type": "Long"
    },
    {
      "values": [
        4,
        3,
        3,
        5,
        5,
        3,
        9,
        7,
        7,
        7
      ],
      "name": "Status_Long[Bad]",
      "type": "Long"
    },
    {
      "values": [
        11,
        9,
        13,
        9,
        6,
        9,
        8,
        7,
        8,
        5
      ],
      "name": "Status_Long[Other]",
      "type": "Long"
    },
    {
      "values": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ],
      "name": "Status_Long[Unknown]",
      "type": "Long"
    }
  ],
  "progress": 100
}

QueryAggregateSeriesWithSampleInterpolation

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "aggregateSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "interval": "PT1M",
    "inlineVariables": {
      "LinearSampleInterpolation": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "interpolation": {
          "kind": "Linear",
          "boundary": {
            "span": "P1D"
          }
        },
        "aggregation": {
          "tsx": "left($value)"
        }
      },
      "StepSampleInterpolation": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "interpolation": {
          "kind": "Step",
          "boundary": {
            "span": "P1D"
          }
        },
        "aggregation": {
          "tsx": "left($value)"
        }
      }
    },
    "projectedVariables": [
      "LinearSampleInterpolation",
      "StepSampleInterpolation"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:00Z",
    "2016-08-01T00:01:00Z",
    "2016-08-01T00:02:00Z",
    "2016-08-01T00:03:00Z",
    "2016-08-01T00:04:00Z",
    "2016-08-01T00:05:00Z",
    "2016-08-01T00:06:00Z",
    "2016-08-01T00:07:00Z",
    "2016-08-01T00:08:00Z",
    "2016-08-01T00:09:00Z",
    "2016-08-01T00:10:00Z"
  ],
  "properties": [
    {
      "name": "LinearSampleInterpolation",
      "type": "Double",
      "values": [
        50,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        62
      ]
    },
    {
      "name": "StepSampleInterpolation",
      "type": "Double",
      "values": [
        71.25,
        85,
        82.5,
        80,
        89.16666666666667,
        75,
        90,
        75.83333333333333,
        85,
        82.5,
        84
      ]
    }
  ],
  "progress": 100
}

QueryGetEventsPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

QueryGetEventsPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAxYZwidGFrZSI6MTAwMH0="
}

QueryGetEventsPage3

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        67.575
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAbCDewidGFrZSI6MTAwMH0="
}

QueryGetEventsPage4

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [],
  "properties": [],
  "progress": 100
}

QueryGetEventsWithTakePage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ],
    "take": 10
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

QueryGetEventsWithTakePage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ],
    "take": 10
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375
      ]
    }
  ],
  "progress": 100
}

QueryGetSeriesPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

QueryGetSeriesPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z",
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375,
        67.625
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAxYZwidGFrZSI6MTAwMH0="
}

QueryGetSeriesPage3

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:21Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        67.825
      ]
    }
  ],
  "progress": 100
}

QueryGetSeriesWithTakePage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ],
    "take": 10
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

QueryGetSeriesWithTakePage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ],
    "take": 10
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z",
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375,
        67.625
      ]
    }
  ],
  "progress": 100
}

WarmStoreQueryAggregateSeriesPage

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "aggregateSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "interval": "PT1M",
    "inlineVariables": {
      "Count": {
        "kind": "aggregate",
        "filter": null,
        "aggregation": {
          "tsx": "count()"
        }
      },
      "MinTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "min($value)"
        }
      },
      "MaxTemperature": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "max($value)"
        }
      }
    },
    "projectedVariables": [
      "Count",
      "MinTemperature",
      "MaxTemperature"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:00Z",
    "2016-08-01T00:01:00Z",
    "2016-08-01T00:02:00Z",
    "2016-08-01T00:03:00Z",
    "2016-08-01T00:04:00Z",
    "2016-08-01T00:05:00Z",
    "2016-08-01T00:06:00Z",
    "2016-08-01T00:07:00Z",
    "2016-08-01T00:08:00Z",
    "2016-08-01T00:09:00Z",
    "2016-08-01T00:10:00Z"
  ],
  "properties": [
    {
      "name": "Count",
      "type": "Long",
      "values": [
        50,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        60,
        null
      ]
    },
    {
      "name": "AverageTemperature",
      "type": "Double",
      "values": [
        71.25,
        85,
        82.5,
        80,
        89.16666666666667,
        75,
        90,
        75.83333333333333,
        85,
        82.5,
        null
      ]
    },
    {
      "name": "MinTemperature",
      "type": "Double",
      "values": [
        65.125,
        77.625,
        65.125,
        72.625,
        65.125,
        67.625,
        82.625,
        65.125,
        77.625,
        65.125,
        null
      ]
    },
    {
      "name": "MaxTemperature",
      "type": "Double",
      "values": [
        77.375,
        92.375,
        99.875,
        87.375,
        99.875,
        82.375,
        97.375,
        99.875,
        92.375,
        99.875,
        null
      ]
    }
  ],
  "progress": 100
}

WarmStoreQueryGetEventsPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

WarmStoreQueryGetEventsPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium",
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAxYZwidGFrZSI6MTAwMH0="
}

WarmStoreQueryGetEventsPage3

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "Building",
      "type": "String",
      "values": [
        "Millenium"
      ]
    },
    {
      "name": "Temperature",
      "type": "Double",
      "values": [
        67.575
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAbCDewidGFrZSI6MTAwMH0="
}

WarmStoreQueryGetEventsPage4

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getEvents": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": {
      "tsx": "($event.Value.Double != null) OR ($event.Status.String = 'Good')"
    },
    "projectedProperties": [
      {
        "name": "Building",
        "type": "String"
      },
      {
        "name": "Temperature",
        "type": "Double"
      }
    ]
  }
}

Sample response

{
  "timestamps": [],
  "properties": [],
  "progress": 100
}

WarmStoreQueryGetSeriesPage1

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAwMCwidGFrZSI6MTAwMH0="
}

WarmStoreQueryGetSeriesPage2

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:10Z",
    "2016-08-01T00:00:11Z",
    "2016-08-01T00:00:12Z",
    "2016-08-01T00:00:13Z",
    "2016-08-01T00:00:14Z",
    "2016-08-01T00:00:15Z",
    "2016-08-01T00:00:16Z",
    "2016-08-01T00:00:17Z",
    "2016-08-01T00:00:18Z",
    "2016-08-01T00:00:19Z",
    "2016-08-01T00:00:20Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        65.125,
        65.375,
        65.625,
        65.875,
        66.125,
        66.375,
        66.625,
        66.875,
        67.125,
        67.375,
        67.625
      ]
    }
  ],
  "progress": 50,
  "continuationToken": "aXsic2tpcCI6MTAxYZwidGFrZSI6MTAwMH0="
}

WarmStoreQueryGetSeriesPage3

Sample request

POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/query?api-version=2020-07-31&storeType=warmstore

{
  "getSeries": {
    "timeSeriesId": [
      "006dfc2d-0324-4937-998c-d16f3b4f1952",
      "T1"
    ],
    "searchSpan": {
      "from": "2016-08-01T00:00:00Z",
      "to": "2016-08-01T00:16:50Z"
    },
    "filter": null,
    "inlineVariables": {
      "temperatures": {
        "kind": "numeric",
        "value": {
          "tsx": "$event.Temperature"
        },
        "filter": null,
        "aggregation": {
          "tsx": "avg($value)"
        }
      }
    },
    "projectedVariables": [
      "temperatures"
    ]
  }
}

Sample response

{
  "timestamps": [
    "2016-08-01T00:00:21Z"
  ],
  "properties": [
    {
      "name": "temperatures",
      "type": "Double",
      "values": [
        67.825
      ]
    }
  ],
  "progress": 100
}

Definitions

Name Description
AggregateSeries

Aggregate Series query. Allows to calculate an aggregated time series from events for a given Time Series ID and search span.

AggregateVariable

Aggregate variable represents any aggregation calculation. Aggregate Variables does not support interpolation.

Boundary

The time range to the left and right of the search span to be used for Interpolation. This is helpful in scenarios where the data points are missing close to the start or end of the input search span. Can be null.

CategoricalVariable

Categorical variable represents signal that needs to be analyzed based on the count or duration of occurrence of limited set of defined values.

DateTimeRange

The range of time. Cannot be null or negative.

EventProperty

Property of an event that is either stored or computed. Properties are identified by both name and type. Different events can have properties with same name, but different type.

GetEvents

Get Events query. Allows to retrieve raw events for a given Time Series ID and search span.

GetSeries

Get Series query. Allows to retrieve time series of calculated variable values from events for a given Time Series ID and search span.

Interpolation

The interpolation operation to be performed on the raw data points. Currently, only sampling of interpolated time series is allowed. Allowed aggregate function - eg: left($value). Can be null if no interpolation needs to be applied.

InterpolationKind

The type of interpolation technique : "Linear" or "Step".

NumericVariable

Numeric variable represents a single continuous numeric signal that can be reconstructed using interpolation.

PropertyTypes

The type of the property.

PropertyValues

Values of a single property corresponding to the timestamps. May contain nulls. Type of values matches the type of property.

QueryRequest

Request to execute a time series query over events. Exactly one of "getEvents", "getSeries" or "aggregateSeries" must be set.

QueryResultPage

A single page of query results. If query has not finished yet, a page will have continuation token set. In this case, to get the next page of results, send the same request again with continuation token parameter. If query has completed, the continuation token is null. It is also possible to get an empty page with only continuation token set when no query results have been computed yet. If paging has completed (continuation token is null), then timestamps and properties may be empty if there is no data to return.

TimeSeriesAggregateCategory

Category used in categorical variables. A category is defined by 'label' and the 'values' that are assigned this label.

TimeSeriesDefaultCategory

Represents the default category.

TsiError

Information about an API error.

TsiErrorBody

A particular API error with an error code and a message.

TsiErrorDetails

Additional error information.

Tsx

Time series expression (TSX) written as a single string. Examples: "$event.Status.String='Good'", "avg($event.Temperature)". Refer to the documentation on how to write time series expressions.

AggregateSeries

Aggregate Series query. Allows to calculate an aggregated time series from events for a given Time Series ID and search span.

Name Type Description
filter

Tsx

Top-level filter over the events that restricts the number of events being considered for computation. This filter is AND'ed with filter in each variable. Example: "$event.Status.String='Good'". Optional.

inlineVariables

object

This allows the user the optionally define inline-variables apart from the ones already defined in the model. When the inline variable names have the same name as the model, the inline variable definition takes precedence. Can be null.

interval

string

Interval size is specified in ISO-8601 duration format. All intervals are the same size. One month is always converted to 30 days, and one year is always 365 days. Examples: 1 minute is "PT1M", 1 millisecond is "PT0.001S". For more information, see https://www.w3.org/TR/xmlschema-2/#duration

projectedVariables

string[]

This allows the user to optionally select the variables that needs to be projected. When it is null or not set, all the variables from inlineVariables and model are returned. Can be null.

searchSpan

DateTimeRange

The range of time on which the query is executed. Cannot be null.

timeSeriesId

TimeSeriesId[]

A single Time Series ID value that uniquely identifies a single time series instance (e.g. a device). Note that a single Time Series ID can be composite if multiple properties are specified as Time Series ID at environment creation time. The position and type of values must match Time Series ID properties specified on the environment and returned by Get Model Setting API. Cannot be null.

AggregateVariable

Aggregate variable represents any aggregation calculation. Aggregate Variables does not support interpolation.

Name Type Description
aggregation

Tsx

Aggregation time series expression when kind is "aggregate" is used to represent the aggregation that needs to be performed directly using event properties like "$event.Temperature". For example, aggregation for calculating range of temperature changes can be written as: "max($event.Temperature)-min($event.Temperature)".

filter

Tsx

Filter over the events that restricts the number of events being considered for computation. Example: "$event.Status.String='Good'". Optional.

kind string:

aggregate

Allowed "kind" values are - "numeric" or "aggregate". While "numeric" allows you to specify value of the reconstructed signal and the expression to aggregate them, the "aggregate" kind lets you directly aggregate on the event properties without specifying value.

Boundary

The time range to the left and right of the search span to be used for Interpolation. This is helpful in scenarios where the data points are missing close to the start or end of the input search span. Can be null.

Name Type Description
span

string

CategoricalVariable

Categorical variable represents signal that needs to be analyzed based on the count or duration of occurrence of limited set of defined values.

Name Type Description
categories

TimeSeriesAggregateCategory[]

Category used in categorical variables. A category is defined by 'label' and the 'values' that are assigned this label.

defaultCategory

TimeSeriesDefaultCategory

Represents the default category.

filter

Tsx

Filter over the events that restricts the number of events being considered for computation. Example: "$event.Status.String='Good'". Optional.

interpolation

Interpolation

Categorical variable supports only 'step' interpolation.

kind string:

categorical

Allowed "kind" values are - "numeric" or "aggregate". While "numeric" allows you to specify value of the reconstructed signal and the expression to aggregate them, the "aggregate" kind lets you directly aggregate on the event properties without specifying value.

value

Tsx

Value time series expression is used to represent the value of the signal that is going to be categorized. It can evaluate to only 'String' or 'Long' type for categorical variables.

DateTimeRange

The range of time. Cannot be null or negative.

Name Type Description
from

string

Start timestamp of the time range. Start timestamp is inclusive when used in time series query requests. Events that have this timestamp are included.

to

string

End timestamp of the time range. End timestamp is exclusive when used in time series query requests. Events that match this timestamp are excluded. Note that end timestamp is inclusive when returned by Get Availability (meaning that there is an event with this exact "to" timestamp).

EventProperty

Property of an event that is either stored or computed. Properties are identified by both name and type. Different events can have properties with same name, but different type.

Name Type Description
name

string

The name of the property.

type

PropertyTypes

The type of the property.

GetEvents

Get Events query. Allows to retrieve raw events for a given Time Series ID and search span.

Name Type Description
filter

Tsx

Optional top-level filter for the query which will be applied to all the variables in the query. Example: "$event.Status.String='Good'". Can be null.

projectedProperties

EventProperty[]

Projected properties is an array of properties which you want to project. These properties must appear in the events; otherwise, they are not returned.

searchSpan

DateTimeRange

The range of time on which the query is executed. Cannot be null.

take

integer

Maximum number of property values in the whole response set, not the maximum number of property values per page. Defaults to 10,000 when not set. Maximum value of take can be 250,000.

timeSeriesId

TimeSeriesId[]

A single Time Series ID value that uniquely identifies a single time series instance (e.g. a device). Note that a single Time Series ID can be composite if multiple properties are specified as Time Series ID at environment creation time. The position and type of values must match Time Series ID properties specified on the environment and returned by Get Model Setting API. Cannot be null.

GetSeries

Get Series query. Allows to retrieve time series of calculated variable values from events for a given Time Series ID and search span.

Name Type Description
filter

Tsx

Top-level filter over the events that restricts the number of events being considered for computation. This filter is AND'ed with filter in each variable. Example: "$event.Status.String='Good'". Optional.

inlineVariables

object

Optional inline variables apart from the ones already defined in the time series type in the model. When the inline variable name is the same name as in the model, the inline variable definition takes precedence. Can be null.

projectedVariables

string[]

Selected variables that needs to be projected in the query result. When it is null or not set, all the variables from inlineVariables and time series type in the model are returned. Can be null.

searchSpan

DateTimeRange

The range of time on which the query is executed. Cannot be null.

take

integer

Maximum number of property values in the whole response set, not the maximum number of property values per page. Defaults to 10,000 when not set. Maximum value of take can be 250,000.

timeSeriesId

TimeSeriesId[]

A single Time Series ID value that uniquely identifies a single time series instance (e.g. a device). Note that a single Time Series ID can be composite if multiple properties are specified as Time Series ID at environment creation time. The position and type of values must match Time Series ID properties specified on the environment and returned by Get Model Setting API. Cannot be null.

Interpolation

The interpolation operation to be performed on the raw data points. Currently, only sampling of interpolated time series is allowed. Allowed aggregate function - eg: left($value). Can be null if no interpolation needs to be applied.

Name Type Description
boundary

Boundary

The time range to the left and right of the search span to be used for Interpolation. This is helpful in scenarios where the data points are missing close to the start or end of the input search span. Can be null.

kind

InterpolationKind

The type of interpolation technique : "Linear" or "Step".

InterpolationKind

The type of interpolation technique : "Linear" or "Step".

Name Type Description
Linear

string

Step

string

NumericVariable

Numeric variable represents a single continuous numeric signal that can be reconstructed using interpolation.

Name Type Description
aggregation

Tsx

Aggregation time series expression when kind is "numeric" is used to represent the aggregation that needs to be performed on the $value expression. This requires $value to be specified and can only use $value inside the aggregate functions. For example, aggregation for calculating minimum of the $value is written as: "min($value)".

filter

Tsx

Filter over the events that restricts the number of events being considered for computation. Example: "$event.Status.String='Good'". Optional.

interpolation

Interpolation

The interpolation operation to be performed on the raw data points. Currently, only sampling of interpolated time series is allowed. Allowed aggregate function - eg: left($value). Can be null if no interpolation needs to be applied.

kind string:

numeric

Allowed "kind" values are - "numeric" or "aggregate". While "numeric" allows you to specify value of the reconstructed signal and the expression to aggregate them, the "aggregate" kind lets you directly aggregate on the event properties without specifying value.

value

Tsx

Value time series expression is used to represent the value of the signal that is going to be aggregated or interpolated. For example, temperature values from the event is represented like this: "$event.Temperature.Double".

PropertyTypes

The type of the property.

Name Type Description
Bool

string

DateTime

string

Double

string

Long

string

String

string

TimeSpan

string

PropertyValues

Values of a single property corresponding to the timestamps. May contain nulls. Type of values matches the type of property.

Name Type Description
name

string

The name of the property.

type

PropertyTypes

The type of the property.

values

Values[]

Values of a single property corresponding to the timestamps. May contain nulls. Type of values matches the type of property.

QueryRequest

Request to execute a time series query over events. Exactly one of "getEvents", "getSeries" or "aggregateSeries" must be set.

Name Type Description
aggregateSeries

AggregateSeries

Aggregate Series query. Allows to calculate an aggregated time series from events for a given Time Series ID and search span.

getEvents

GetEvents

Get Events query. Allows to retrieve raw events for a given Time Series ID and search span.

getSeries

GetSeries

Get Series query. Allows to retrieve time series of calculated variable values from events for a given Time Series ID and search span.

QueryResultPage

A single page of query results. If query has not finished yet, a page will have continuation token set. In this case, to get the next page of results, send the same request again with continuation token parameter. If query has completed, the continuation token is null. It is also possible to get an empty page with only continuation token set when no query results have been computed yet. If paging has completed (continuation token is null), then timestamps and properties may be empty if there is no data to return.

Name Type Description
continuationToken

string

If returned, this means that current results represent a partial result. Continuation token allows to get the next page of results. To get the next page of query results, send the same request with continuation token parameter in "x-ms-continuation" HTTP header.

progress

number

Approximate progress of the query in percentage. It can be between 0 and 100. When the continuation token in the response is null, the progress is expected to be 100.

properties

PropertyValues[]

Collection of time series properties and values for each of the timestamps. Can be null if server was unable to fill the page in this request, or can be empty if there are no more objects when continuation token is null.

timestamps

string[]

The timestamps of the values of the time series. If an aggregation over intervals is used, timestamps represent the start of corresponding intervals. If events are retrieved, timestamps are values of timestamp $ts property of events. Can be null if server was unable to fill the page in this request, or can be empty if there are no more objects when continuation token is null.

TimeSeriesAggregateCategory

Category used in categorical variables. A category is defined by 'label' and the 'values' that are assigned this label.

Name Type Description
label

string

The name of the category which will be used in constructing the output variable names.

values

object[]

The list of values that a category maps to. Can be either a unique list of string or list of long.

TimeSeriesDefaultCategory

Represents the default category.

Name Type Description
label

string

The name of the default category which will be assigned to the values that does not match any of those that are defined in the 'categories'.

TsiError

Information about an API error.

Name Type Description
error

TsiErrorBody

A particular API error with an error code and a message.

TsiErrorBody

A particular API error with an error code and a message.

Name Type Description
code

string

Language-independent, human-readable string that defines a service-specific error code. This code serves as a more specific indicator for the HTTP error code specified in the response. Can be used to programmatically handle specific error cases.

details

TsiErrorDetails[]

Contains additional error information. May be null.

innerError

TsiErrorBody

Contains more specific error that narrows down the cause. May be null.

message

string

Human-readable, language-independent representation of the error. It is intended as an aid to developers and is not suitable for exposure to end users.

target

string

Target of the particular error (for example, the name of the property in error). May be null.

TsiErrorDetails

Additional error information.

Name Type Description
code

string

Language-independent, human-readable string that defines a service-specific error code. This code serves as a more specific indicator for the HTTP error code specified in the response. Can be used to programmatically handle specific error cases.

message

string

Human-readable, language-independent representation of the error. It is intended as an aid to developers and is not suitable for exposure to end users.

Tsx

Time series expression (TSX) written as a single string. Examples: "$event.Status.String='Good'", "avg($event.Temperature)". Refer to the documentation on how to write time series expressions.

Name Type Description
tsx

string

Time series expression (TSX) written as a single string. Examples: "$event.Status.String='Good'", "avg($event.Temperature)". Refer to the documentation on how to write time series expressions.