Stream GetSummary
- Last UpdatedJun 15, 2023
- 3 minute read
- PI System
- PI Web API Reference
- Developer
Stream GetSummary
Returns a summary over the specified time range for the stream.
Remarks
Count is the only summary type supported on non-numeric streams. Requesting a summary for any other type will generate an error. Time-weighted totals are computed by integrating the rate tag values over the requested time range. If some of the data are bad in the time range, the calculated total is divided by the fraction of the time period for which there are good values. This approach is equivalent to assuming that during the period of bad data, the tag takes on the average values for the entire calculation time range. The PercentGood summary may be used to determine if the calculation results are suitable for the application's purposes. For time-weighted totals, if the time unit rate of the stream cannot be determined, then the value will be totaled assuming a unit of "per day" and no unit of measure will be assigned to the value. If the measured time component of the tag is not based on a day, the user of the data must convert the totalized value to the correct units.
Request
GET streams/{webId}/summary
URL Parameters
-
webId The ID of the stream. See WebID for more information.
-
startTime An optional start time. The default is '*-1d' for element attributes and points. For event frame attributes, the default is the event frame's start time, or '*-1d' if that is not set. See Time Strings for more information.
-
endTime An optional end time. The default is '*' for element attributes and points. For event frame attributes, the default is the event frame's end time, or '*' if that is not set. Note that if endTime is earlier than startTime, the resulting values will be in time-descending order. See Time Strings for more information.
-
timeZone The time zone in which the time string will be interpreted. This parameter will be ignored if a time zone is specified in the time string. If no time zone is specified in either places, the PI Web API server time zone will be used. See Time Zone for more information.
-
summaryType Specifies the kinds of summaries to produce over the range. The default is 'Total'. Multiple summary types may be specified by using multiple instances of summaryType. See Summary Type for more information.
-
calculationBasis Specifies the method of evaluating the data over the time range. The default is 'TimeWeighted'. See Calculation Basis for more information.
-
timeType Specifies how to calculate the timestamp for each interval. The default is 'Auto'. See Time Type for more information.
-
summaryDuration The duration of each summary interval. If specified in hours, minutes, seconds, or milliseconds, the summary durations will be evenly spaced UTC time intervals. Longer interval types are interpreted using wall clock rules and are time zone dependent.
-
sampleType Defines the evaluation of an expression over a time range. The default is 'ExpressionRecordedValues'. See Sample Type for more information.
-
sampleInterval When the sampleType is Interval, sampleInterval specifies how often the filter expression is evaluated when computing the summary for an interval.
-
filterExpression A string containing a filter expression. Expression variables are relative to the attribute. Use '.' to reference the containing attribute.
-
selectedFields List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.
Status Codes
200: The summaries that meet the specified conditions.
409: The data reference does not support this method.
Sample Response Body
{
"Items": [
{
"Type": "Total",
"Value": {
"Timestamp": "2014-07-22T14:00:00Z",
"UnitsAbbreviation": "m",
"Good": true,
"Questionable": false,
"Substituted": false,
"Annotated": false,
"Value": 12.3
}
},
{
"Type": "Total",
"Value": {
"Timestamp": "2014-07-22T14:00:00Z",
"UnitsAbbreviation": "m",
"Good": true,
"Questionable": false,
"Substituted": false,
"Annotated": false,
"Value": 12.3
}
}
],
"Links": {}
}