Data retrieval
- Last UpdatedSep 11, 2023
- 3 minute read
The Historian Data REST API allows you to retrieve data from your solution. Data retrieval with the Historian Data REST API is available through both AVEVA Insight and Historian Client Web, so ensure that you refer to the correct syntax for your product from the examples below.
Forming retrieval requests
Use this syntax to form your retrieval requests:
AVEVA Insight - Token authentication only
http://online.wonderware.[DOMAINSUFFIX]/Historian/<api_version>/<resource>?lt;query_parameters>
AVEVA Insight - Basic authentication only
http://online.wonderware.[DOMAINSUFFIX]/s/{SolutionID}/Historian/<api_version>/<resource>?lt;query_parameters>
Historian Client Web
http://<servername>:32569/Historian/<api_version>/<resource>?lt;query_parameters>
This URL includes these parts:
|
Syntax element |
Explanation |
|---|---|
|
(AVEVA Insight only) online.wonderware.[DOMAINSUFFIX] |
The servername used by AVEVA Insight. |
|
(Historian Client Web only) <servername>:32569 |
The servername and port number used by AVEVA Historian Client Web. If the server is the local computer, this will be "localhost:32569". |
|
(AVEVA Insight only; using basic auth) s/{SolutionID} |
The solution ID, if performing a data retrieval using basic authentication. Replace {SolutionID} with your unique solution ID. See Retrieval endpoint and tokens for more information. |
|
Historian/<api_version> |
The API and version. |
|
<resource> |
The Historian Data REST API retrieval resource. See the complete list. |
|
?<query_parameters> |
Query parameters, using OData syntax tokens and operators |
For example, this retrieval request gets analog summary data via an endpoint URL using basic authentication:
AVEVA Insight - Token authentication only
http://online.wonderware.[DOMAINSUFFIX]/Historian/v2/AnalogSummary
?$filter=FQN+eq+'Depot.Train09'+and+StartDateTime+ge+2017-06-09T09:00:00-07:00+and
+EndDateTime+le+2017-06-09T10:00:00-07:00&Resolution=3600000
AVEVA Insight - Basic authentication only
http://online.wonderware.[DOMAINSUFFIX]/s/{SolutionID}/Historian/v2/AnalogSummary
?$filter=FQN+eq+'Depot.Train09'+and+StartDateTime+ge+2017-06-09T09:00:00-07:00+and
+EndDateTime+le+2017-06-09T10:00:00-07:00&Resolution=3600000
Historian Client Web
http://localhost:32569/Historian/v2/AnalogSummary
?$filter=FQN+eq+'Depot.Train09'+and+StartDateTime+ge+2017-06-09T09:00:00-07:00+and
+EndDateTime+le+2017-06-09T10:00:00-07:00&Resolution=3600000
Two powerful parameters: RetrievalMode and Resolution
You can use the RetrievalMode and Resolution parameters in retrieval queries to better control of your search results.
-
RetrievalMode specifies how the resulting data is calculated for Raw and ProcessValues entities. Valid values are:
-
Average
-
Cyclic
-
Integral
-
Minimum
-
Round Trip
-
BestFit
-
Delta
-
Interpolated
-
Slope
-
Value State
-
Counter
-
Full
-
Maximum
-
StartBound
-
-
Resolution specifies the granularity of data returned for Raw, ProcessValues, and Summary entities.
Supported syntax tokens and operators
These tokens are supported for system query via the Historian Data REST API. They are all case-sensitive.
|
Token |
Description |
|---|---|
|
$filter |
Specifies an expression or function that must evaluate to true for a record to be returned in the collection. All typical OData functions are supported for the $filter clause. The $filter expression supports references to properties and literals. Literal values include:
|
|
$select |
Specifies a subset of properties to return. |
|
$skip |
Specifies the number of records to skip from the beginning of the result set. |
|
$skiptoken |
Used to get the next record set that satisfies the query conditions. You do not need to include this token in the query, but you will see it upon query execution. |
|
$top |
Specifies the maximum number of records to return. This subset is formed by selecting only the first N items of the set, where N is a positive integer specified by this query option. |
These logical operators are supported for the query options:
|
Operator |
Description |
|---|---|
|
eq |
Equal |
|
ne |
Not equal Note: This operator is not supported with the Tags resource. |
|
gt |
Greater than |
|
ge |
Greater than or equal |
|
lt |
Less than |
|
le |
Less than or equal |
|
and |
Logical and |
|
or |
Logical or |
|
not |
Logical negation |
In the filter expression, you can have only a single time clause combined with a single filter clause using the "and" operator. The filter clause itself can be complex, using any of the supported logical operators. Use parentheses ( ) to create precedence groups within an expression in filter clause.
Note: Use "%20" to indicate a space. Use "%27" to indicate a single quote.
If the expression includes multiple values for the criteria, you must specify each criteria separately using the "or" operator. For example:
...
((Priority+eq+100+or+Priority+eq+200+or+Priority+eq+500
+or+Priority+eq+700)+and+(filter …))