getAssetPropertyValueHistory method

Future<GetAssetPropertyValueHistoryResponse> getAssetPropertyValueHistory({
  1. String? assetId,
  2. DateTime? endDate,
  3. int? maxResults,
  4. String? nextToken,
  5. String? propertyAlias,
  6. String? propertyId,
  7. List<Quality>? qualities,
  8. DateTime? startDate,
  9. TimeOrdering? timeOrdering,
})

Gets the history of an asset property's values. For more information, see Querying historical values in the IoT SiteWise User Guide.

To identify an asset property, you must specify one of the following:

  • The assetId and propertyId of an asset property.
  • A propertyAlias, which is a data stream alias (for example, /company/windfarm/3/turbine/7/temperature). To define an asset property's alias, see UpdateAssetProperty.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter assetId : The ID of the asset, in UUID format.

Parameter endDate : The inclusive end of the range from which to query historical data, expressed in seconds in Unix epoch time.

Parameter maxResults : The maximum number of results to return for each paginated request. A result set is returned in the two cases, whichever occurs first.

  • The size of the result set is equal to 4 MB.
  • The number of data points in the result set is equal to the value of maxResults. The maximum value of maxResults is 20000.

Parameter nextToken : The token to be used for the next set of paginated results.

Parameter propertyAlias : The alias that identifies the property, such as an OPC-UA server data stream path (for example, /company/windfarm/3/turbine/7/temperature). For more information, see Mapping industrial data streams to asset properties in the IoT SiteWise User Guide.

Parameter propertyId : The ID of the asset property, in UUID format.

Parameter qualities : The quality by which to filter asset data.

Parameter startDate : The exclusive start of the range from which to query historical data, expressed in seconds in Unix epoch time.

Parameter timeOrdering : The chronological sorting order of the requested information.

Default: ASCENDING

Implementation

Future<GetAssetPropertyValueHistoryResponse> getAssetPropertyValueHistory({
  String? assetId,
  DateTime? endDate,
  int? maxResults,
  String? nextToken,
  String? propertyAlias,
  String? propertyId,
  List<Quality>? qualities,
  DateTime? startDate,
  TimeOrdering? timeOrdering,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  final $query = <String, List<String>>{
    if (assetId != null) 'assetId': [assetId],
    if (endDate != null) 'endDate': [_s.iso8601ToJson(endDate).toString()],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (propertyAlias != null) 'propertyAlias': [propertyAlias],
    if (propertyId != null) 'propertyId': [propertyId],
    if (qualities != null)
      'qualities': qualities.map((e) => e.value).toList(),
    if (startDate != null)
      'startDate': [_s.iso8601ToJson(startDate).toString()],
    if (timeOrdering != null) 'timeOrdering': [timeOrdering.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/properties/history',
    queryParams: $query,
    hostPrefix: 'data.',
    exceptionFnMap: _exceptionFns,
  );
  return GetAssetPropertyValueHistoryResponse.fromJson(response);
}