Calculated Data API

The Calculated Data API queries the calculated data for a list of tags. Data can be requested using a number of samples or a time range for a list of tags. If the count is not zero, the service returns the number of raw samples beginning from the start time. If the count is zero, the services uses the interval, start time, and end time to calculate the required sample number.

METHOD:GET, POST
URI:
GET
https://<historianservername>:8443/historian-rest-api/v1/datapoints/calculated/{tagNames}/{start}/{end}/{calculationMode}/{count}/{intervalMs}
POST
https://<historianservername>:8443/historian-rest-api/v1/datapoints/calculated/{start}/{end}/{calculationMode}/{count}/{intervalMs}
SAMPLE GET URI:
Number of Samples
https://<historianservername>:8443/historian-rest-api/v1/datapoints/calculated/tagName1/2013-10-02T11:30:00.111Z/2013-10-02T11:31:11.111Z/1/100/1000
Time Range for List of Tags
https://<historianservername>:8443/historian-rest-api/v1/datapoints/calculated?tagNames=tagName1&start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&count=100&calculationMode=1&intervalMs=1000
SAMPLE POST URI:
Number of Samples
https://<historianservername>:8443/historian-rest-api/v1/datapoints/calculated/2013-10-02T11:30:00.111Z/2013-10-02T11:31:11.111Z/1/100/1000
Time Range for List of Tags
https://<historianservername>:8443/historian-rest-api/v1/datapoints/calculated?start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&count=100&calculationMode=1&intervalMs=1000
SAMPLE cURL COMMAND (GET):curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN> http://<nodename>:8843/ historian-rest-api/v1/ datapoints/calculated/<tagName>/<start time>/<end time>/<count>/<calculation mode>/<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>\ ?} http://<nodename>:8843/ historian-rest-api/v1/ datapoints/calculated/<start time>/<end time>/<count>/<calculationmode>/<intervalMS>

Query Parameters

ParameterDescriptionRequired?Values
TagNamesGE identifier for a location.Yes1000000106
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
CountCount of archive values within each calculation interval.YesInteger, with a value such as 100.
Calculation ModeEnd time in milliseconds.YesInteger, with a value such as 1.
IntervalMSInterval in milliseconds.64-bit signed integer, with a value such as 1000.

Response Parameters

ParameterData TypeRequired?Description
ErrorCodeIntegerYesFor example, 0.
ErrorCodeStringYesFor example, NULL.
DataStringYesThe object container for the following parameters:
DataType
DoubleFloat, which stores decimal values up to 15 places.
ErrorCode
Value is 0, which means the operation was successful.
TagName
Example is TagName1.
Samples
Provides TimeStamp, Value and Quality for each sample. For example, TimeStamp = 2013-10-02T11:30:00.111Z, Value = 34.26155, and Quality = 3.

Sample Response

{
     "ErrorCode" : 0,
     "ErrorMessage": null,
     "Data":[{
      "DataType":"DoubleFloat",
      "ErrorCode":0,
      "TagName":"TagName1",
      "Samples":[ { "TimeStamp":"2013-10-02T11:30:00.111Z","Value":"34.26155","Quality":3 },
                  {  "TimeStamp":"2013-10-02T11:30:10.111Z", "Value":"37.26155", "Quality":3  }, 
                  {  "TimeStamp":"2013-10-02T11:31:00.111Z", "Value":"33.26155", "Quality":3  } 
                ]
     }]
}