Raw Data API

The Raw Data API queries raw data, such as a number of samples or the time range for a list of tags. If the count is not zero, then the API service returns the number of raw samples taken beginning from the start time. If the count is zero, then the service returns the raw samples taken between the start time and the end time.

METHOD:GET, POST
URI:
GET
https://<historianservername>:8443/historian-rest-api/v1/datapoints/raw/{tagNames}/{start}/{end}/{direction}/{count}
POST
https://<historianservername>:8443/historian-rest-api/v1/datapoints/raw/{start}/{end}/{direction}/{count}
SAMPLE GET URI:

Raw By Number

Count value is a non-zero positive number, and end time is greater than start time.

https://<historianservername>:8443/historian-rest-api/datapoints/raw/tagName1/2013-10-02T11:30:00.111Z/2013-10-02T11:31:11.111Z/0/100https://<historianservername>:8443/historian-rest-api/datapoints/raw?tagNames=tagName1&start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&count=100&direction=0

Raw By Time

The count value equals 0.

https://<historianservername>:8443/historian-rest-api/datapoints/raw/tagName1/2013-10-02T11:30:00.111Z/2013-10-02T11:31:11.111Z/0/0https://<historianservername>:8443/historian-rest-api/datapoints/raw?tagNames=tagName1&start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&count=0&direction=0
SAMPLE POST URI:

Raw By Number

Count value is a non-zero positive number, and end time is greater than start time.

https://<historianservername>:8443/historian-rest-api/datapoints/raw/2013-10-02T11:30:00.111Z/2013-10-02T11:31:11.111Z/0/100https://<historianservername>:8443/historian-rest-api/datapoints/raw?start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&count=100&direction=0

Raw By Time

The count value equals 0.

https://<historianservername>:8443/historian-rest-api/datapoints/raw/2013-10-02T11:30:00.111Z/2013-10-02T11:31:11.111Z/0/0https://<historianservername>:8443/historian-rest-api/datapoints/raw?start=2013-10-02T11:30:00.111Z&end=2013-10-02T11:31:11.111Z&count=0&direction=0
SAMPLE cURL COMMAND (GET): [Raw By Number]curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN> http://<nodename>:8443/ historian-rest-api/v1/ datapoints/raw/<tagName>/<start time>/<end time>/<direction>/<count>
SAMPLE cURL COMMAND (GET): [Raw By Time]curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN> http://<nodename>:8443/ historian-rest-api/v1/ datapoints/raw/<tagName>/<start time>/<end time>/<direction>/0
SAMPLE cURL COMMAND (POST): [Raw By Number]curl ?X POST -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer <TOKEN> -d ?{\ ?tagNames\ ?:\ ?<tagName>;<tagName>\ ?} http:// <nodename>/ historian-rest-api/v1/ datapoints/raw/ <start time>/<end time>/<direction>/<count>
SAMPLE cURL COMMAND (POST): [Raw By Time]curl ?X POST -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer <TOKEN> -d ?{\ ?tagNames\ ?:\ ?<tagName>;<tagName>\ ?} http:// <nodename>/ historian-rest-api/v1/ datapoints/raw? start=<start time>&end=<end time>&direction=<direction>&count=<count>

Query Parameters

ParameterDescriptionRequired?Values
TagNamesQueries the specified tag names.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
DirectionSpecifies the direction (Forward or Backward from the starting time) of data sampling from the archive. The default value is Forward (0).YesInteger, with a value such as 0.
CountCount of archive values within each calculation interval.YesInteger, with a value such as 100.

Response Parameters

ParameterData TypeRequired?Description
ErrorCodeIntegerYesFor example, 0.
ErrorMessageStringYesFor 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: 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  }
                ]
     }]
}