BatchGetAssetPropertyAggregates - AWS IoT SiteWise

BatchGetAssetPropertyAggregates

Gets aggregated values (for example, average, minimum, and maximum) for one or more asset properties. For more information, see Querying aggregates in the AWS IoT SiteWise User Guide.

Request Syntax

POST /properties/batch/aggregates HTTP/1.1 Content-type: application/json { "entries": [ { "aggregateTypes": [ "string" ], "assetId": "string", "endDate": number, "entryId": "string", "propertyAlias": "string", "propertyId": "string", "qualities": [ "string" ], "resolution": "string", "startDate": number, "timeOrdering": "string" } ], "maxResults": number, "nextToken": "string" }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

entries

The list of asset property aggregate entries for the batch get request. You can specify up to 16 entries per request.

Type: Array of BatchGetAssetPropertyAggregatesEntry objects

Required: Yes

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 1 MB.

  • The number of data points in the result set is equal to the value of maxResults. The maximum value of maxResults is 4000.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

nextToken

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 4096.

Pattern: [A-Za-z0-9+/=]+

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "errorEntries": [ { "entryId": "string", "errorCode": "string", "errorMessage": "string" } ], "nextToken": "string", "skippedEntries": [ { "completionStatus": "string", "entryId": "string", "errorInfo": { "errorCode": "string", "errorTimestamp": number } } ], "successEntries": [ { "aggregatedValues": [ { "quality": "string", "timestamp": number, "value": { "average": number, "count": number, "maximum": number, "minimum": number, "standardDeviation": number, "sum": number } } ], "entryId": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

errorEntries

A list of the errors (if any) associated with the batch request. Each error entry contains the entryId of the entry that failed.

Type: Array of BatchGetAssetPropertyAggregatesErrorEntry objects

nextToken

The token for the next set of results, or null if there are no additional results.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 4096.

Pattern: [A-Za-z0-9+/=]+

skippedEntries

A list of entries that were not processed by this batch request. because these entries had been completely processed by previous paginated requests. Each skipped entry contains the entryId of the entry that skipped.

Type: Array of BatchGetAssetPropertyAggregatesSkippedEntry objects

successEntries

A list of entries that were processed successfully by this batch request. Each success entry contains the entryId of the entry that succeeded and the latest query result.

Type: Array of BatchGetAssetPropertyAggregatesSuccessEntry objects

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalFailureException

AWS IoT SiteWise can't process your request right now. Try again later.

HTTP Status Code: 500

InvalidRequestException

The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters. Check your request and try again.

HTTP Status Code: 400

ServiceUnavailableException

The requested service is unavailable.

HTTP Status Code: 503

ThrottlingException

Your request exceeded a rate limit. For example, you might have exceeded the number of AWS IoT SiteWise assets that can be created per second, the allowed number of messages per second, and so on.

For more information, see Quotas in the AWS IoT SiteWise User Guide.

HTTP Status Code: 429

Examples

Example

The following example uses the AWS Command Line Interface (AWS CLI) to retrieve the average temperature value for two wind turbines between April 26, 2021 at midnight and May 3, 2021 at midnight in Pacific Time (PT). The following also shows the contents of the batch-get-asset-property-aggregates.json file.

Sample Request

aws iotsitewise batch-get-asset-property-aggregates --cli-input-json file://batch-get-asset-property-aggregates.json
{ "entries":[ { "entryId":"1", "aggregateTypes":[ "AVERAGE" ], "assetId":"a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", "propertyId":"a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "startDate":1619420400, "endDate":1620025200, "qualities":[ "GOOD" ], "resolution":"1h" }, { "entryId":"2", "aggregateTypes":[ "AVERAGE" ], "assetId":"a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "propertyId":"a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "startDate":1619420400, "endDate":1620025200, "qualities":[ "GOOD" ], "resolution":"1h" } ] }

Sample Response

{ "errorEntries" :[ ], "successEntries" :[ { "entryId" :"1", "aggregatedValues" :[ { "timestamp" :1649348973.0, "quality" :"GOOD", "value" :{ "average" :1430.7175 } } ] }, { "entryId" :"2", "aggregatedValues" :[ { "timestamp" :1649348973.0, "quality" :"GOOD", "value" :{ "average" :1425.9525 } } ] } ], "skippedEntries" :[ ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: