Trend Data API

The Trend Data API queries the trend data for a list of tags.

Note: For the query, you can also use optional parameters such as FilterMode and StatisticsItemFilter. Unused parameters can be omitted.
METHOD:GET, POST
URI:
GET
https://<historianservername>:8443/historian-rest-api /v1/datapoints/trend
POST
https://<historianservername>:8443/historian-rest-api /v1/datapoints/trend
SAMPLE GET URI:https://<historianservername>:8443/historian-rest-api /v1/datapoints/trend?tagNames=tagName1&start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&samplingMode=1&calculationMode=1&direction=0&count=0&intervalMs=1000
SAMPLE POST URI:https://<historianservername>:8443/historian-rest-api /v1/datapoints/trend
SAMPLE cURL COMMAND (GET):curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>http://<nodename>:8443/ historian-rest-api/v1/ datapoints/trend/<tagName>/<start time>/<end time>/<samplingMode>/<calculationMode>/<direction>/<count>/<intervalMS>
SAMPLE cURL COMMAND (POST):curl -i X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>-d { \tagNames\:\<tagName>\, \start\: \<start>\, \end\: \<end>\, \samplingMode\: <samplingMode>, \calculationMode\: <calculationMode>, \direction\: <direction>, \count\: <count>, \returnDataFields\: <returnDataFields>, \intervalMs\: <intervalMs>, \queryModifier\: <queryModifier>, \filterMode\: <filterMode>, \filterExpression\: \<filterExpression>\}http://<nodename>:8443/historian-rest-api/v1/datapoints/trend

Query Parameters

ParameterDescriptionRequired?Values
TagNamesQueries the tag names specified.YesString
StartStart time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ).YesDateTime
EndEnd time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ).YesDateTime
SamplingModeAlso known as SamplingModeType.OptionalInteger, with a value such as 1.
CalculationModeAlso known as CalculationModeType.OptionalInteger, with a value such as 1.
DirectionSpecifies the direction (Forward or Backward from the starting time) of data sampling from the archive. The default value is Forward (0).OptionalInteger, with a value such as 0.
CountThe count of archive values within each calculation interval.OptionalInteger, with a value such as 0.
IntervalMSInterval in milliseconds.Optional64-bit signed integer, with a value such as 1000.

Response Parameters

ParameterData TypeRequired?Description
ErrorCodeIntegerYesFor example, 0.
ErrorMessageStringYesFor example, NULL.
DataStringYesThe object container for the following parameters:
TagName
Name of the tag, such as ahistfile.Simulation00001.
TagSource
Location where tags are being searched for.
DataType
Float, which stores decimal values up to 6 places.
Trend
Provides TimeStamp, Value and Quality for each sample. For example, TimeStamp = 2016-03-15T04:53:17.000Z, Value = 170903.6563, and Quality = True.

Sample Response

{
	"ErrorCode": 0,
	"ErrorMessage": null,
	"Data":  {
		"TagName": "ahistfile.Simulation00001",
		"TagSource": "localhost",
		"DataType": "Float",
		"Trend":[
		        { "Timestamp":"2016-03-15T04:53:17.000Z","Value":"170903.6563","Quality":true }
	]}
}