Historian REST APIs

Important: You do not have the latest version of Historian! You are missing out on the newest capabilities and enhanced security. For information on all the latest features, see the Historian product page. For more information on upgrades, contact your GE Digital sales agent or e-mail GE Digital Sales Support. For the most up-to-date documentation, go here.

Overview of the Historian REST APIs

Historian provides the following APIs, which use REST calls to retrieve data and tag information from the Historian archives.
Important: Port 8443 is used in examples and sample code throughout the e-book. If you copy and paste the sample code from this document, you must change this port to your installed port.

Tags API

The Tags API retrieves the qualified tag name list by a given nameMask.
Note: URI format supports asterisks (*) and question marks (?).
METHOD GET
URI https://<historianservername>:8443/historian-rest-api /v1/tags/{nameMask}/{maxNumber}
SAMPLE URI https://<historianservername>:8443/historian-rest-api /v1/tags?nameMask=*&maxNumber=100
SAMPLE cURL COMMAND curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>https://<nodename>:8443/ historian-rest-api/v1/tags?nameMask=*&maxNumber=<Number_Of_Tags>

Query Parameters

Parameter Description Required? Values
nameMask Tagmask that searches for all tags that match the mask and applies the remaining criteria to retrieve data. The mask can include wildcards, such as asterisks (*). Optional String
maxNumber Maximum tag number provides the limit while returning the results (0 by default). This means that for a query, if using 0, all tags are returned.

If a negative number is used, then 0 is used for the maxNumber.

If a positive number is used, then that number of tags is returned. In addition, an error number of +14 notifies the user that there are more than the requested number of tags in the system.

Optional Integer

0 by default

Response Parameters

Parameter Data Type Required? Description
ErrorCode Number Yes For example, ErrorCode = 0, which means the operation was successful.
ErrorMessage String Yes For example, NULL.
tags String Yes Includes the following:
  • ALT_SENSOR
  • tagName1
  • tagName2

Sample Response

{
    "ErrorCode":0,
    "ErrorMessage": null,
    "tags": [
        "ALT_SENSOR",
        "tagName1",
        "tagName2"
    ]
}

Tagslist API

The Tags List API GET method retrieves the list of tags.

When retrieving large tag lists from Historian, you can paginate the response, allowing you to get the next page, go the end, go back one page, and go to the beginning. See .

Tags List Request Parameters

You can use wildcards (*, &,?) with string parameters for pattern matching. Results are sorted in ascending tag names. All parameters use the AND operator. The OR operator is not supported.

All request parameters are optional.

When there are NO wildcard characters (*, &,?) with string parameters for pattern matching, then search would be a contains search

Example: dogpattern will match dog1, dog2,dogs, dogx, dog12, dogs are faithful, 1dog1and so on. When wildcards (*,&, ?) are used in the search string parameters for pattern matching, then they work as per the wildcard character definition.

? - Single character matching

* - Multi character matching

Eg1: dog?pattern will match: dog1, dog2,dogs, dogxand so on but not dog12or dogs are faithful

Eg2: dog*pattern will match dog1, dog2,dogs, dogx, dog12, dogs are faithfuland so on but not 1dog1

Parameter Name Data Type Default Description
calctype Integer -1 Returns exact match of calc type (0,1,2).
collectiondisabled Boolean If ignored, all types considered. Must be only true / false, else error out.
collectioninterval Integer 0 means all intervals If collectorinterval = 0 consider all intervals, else exact match.
collectorcompression Boolean * Returns exact match of collector compression (true/false).
collectorname String * Default * means consider all.
collectortype Integer 0 means consider all collector types Returns exact match of collector type.
comment String * Default * means consider all.
datastorename String * Default * means consider all.
datatype Integer 0 means consider all data types Returns exact match of data type.
description String * Default * means consider all.
egudescription String * Default * means consider all.
enumeratedset String * Default * means consider all.
hasalias Boolean If ignored, all types considered. Must be only true / false, else error out.
isstale Boolean If ignored, all types considered. Must be only true / false, else error out.
lastmodified String 1970-01-01T00:00:00.000Z >= is applied so that last modified tag is returned in the result set.
lastmodifieduser String * Default * means consider all.
numberofelements Integer 0 If 0, ignore this parameter else returns exact match of number of elements.
pageno Integer 1

Must be > 1

If invalid, no data is returned.
pagesize Integer 128

Max 512

Min 2

If out of range, returns error.
sourceaddress String * Default * means consider all.
tagname String * Default * means consider all.
userdefinedtypename String * Default * means consider all.

Tags List Pagination Parameters

When retrieving large tag lists from Historian, you can paginate the response, allowing you to get the next page, go the end, and go back on page and to the beginning. Results with no errors return these pagination parameters:
Parameter Value
pagesize Current page size.
pageno Current page number
totalcount Total result other than current page.
Links to URLs All URLs are part of the HTTP response headers.
  • first First page tags list URL (can be null if count is 0).
  • last - Last page tags list URL (can be null if count is 0).
  • prev Previous page tags list URL (can be null if current page is 1).
  • Next - Next page tags list URL (can be null if current page is last page).

Sample cURL commands

METHOD GET
SAMPLE cURL COMMAND: [lastmodified] curl -i -H "Accept: application/json" -H "Authorization:Bearer <TOKEN>http://<nodename>:8443/historian-rest-api/v1/tagslist?lastmodified=2017-05-01T00:00:00.00Z
SAMPLE cURL COMMAND: [pageno=0] curl -i -H "Accept: application/json" -H "Authorization:Bearer <TOKEN>http://<nodename>:8443/historian-rest-api/v1/tagslist?pageno=0
SAMPLE cURL COMMAND: [pageno=1] curl -i -H "Accept: application/json" -H "Authorization:Bearer <TOKEN>http://<nodename>:8443/historian-rest-api/v1/tagslist?pageno=1
SAMPLE cURL COMMAND: [complete tagslist] curl -i -H "Accept: application/json" -H "Authorization:Bearer <TOKEN>http://<nodename>:8443/historian-rest-api/v1/tagslist

Example Queries

The following request returns first page as pageno is ignored and pagesize is defaulted to 128, all tags are considered:
<baseurl>/v1/tagslist
The following request returns first page as pageno is ignored and pagesize is defaulted to 128, all tags are considered that are modified after 2017-05-01T00:00:00.00Z.
<baseurl>/v1/tagslist?lastmodified=2017-05-01T00:00:00.00Z

Example Results

The following info is returned for each tag from the criteria provided in the request as an array of tag info.
  • tagid - String
  • tagname - String
  • description - String
  • datatype - Integer
  • collectorname - String
  • collectortype - Integer
  • datastorename - String
  • egudescription - String
  • comment - String
  • sourceaddress - String
  • sourceaddress - String
  • collectioninterval - Integer
  • collectorcompression - Boolean
  • lastmodifieduser - String
  • enumeratedset - String
  • userdefinedtypename - String
  • calctype - Integer
  • isstale - Boolean
  • lastmodified - Long
  • lastmodified - Long
  • lastmodifiedString String In readable format
  • has alias - Boolean
  • numberofelements - Integer
  • collectiondisabled - Boolean
For example:
{
	"TotalCount": 1031,
	"Page": 1,
	"PageSize": 4,
	"Tags": [
		{
			"Tagid": "adb70ebf-978f-46dd-ac6f-5e863cdb0739",
			"Tagname": "-anilgwxb.Constant",
			"Description": "anilgwxb.Constant",
			"DataType": 3,
			"CollectorName": "ANILGWXB_Simulation",			
			"CollectorType": 2,
			"DataStoreName": "User",
			"EngineeringUnits": "",
			"Comment": "",
			"SourceAddress": "$Constant",
			"CollectionInterval": 1000,
			"CollectorCompression": false,
			"LastModifiedUser": null,
			"EnumeratedSetName": "",
			"UserDefinedTypeName": "",
			"CalcType": 0,
			"IsStale": false,
			"HasAlias": false,
			"NumberOfElements": 0,
			"CollectionDisabled": false,
			"LastModified": 1496992712,
			"LastModifiedString": "2017-06-09T07:18:32Z"
		},
		{
			"Tagid": "88e1f448-643f-465a-95c2-d2bd08870547",
			"Tagname": "anilgwxb.Constant_1%Noise",
			"Description": "anilgwxb.Constant_1%Noise",
			"DataType": 3,
			"CollectorName": "ANILGWXB_Simulation",
			"CollectorType": 2,
			"DataStoreName": "User",
			"EngineeringUnits": "",
			"Comment": "",
			"SourceAddress": "$Constant_1%Noise",
			"CollectionInterval": 1000,
			"CollectorCompression": false,
			"LastModifiedUser": null,
			"EnumeratedSetName": "",
			"UserDefinedTypeName": "",
			"CalcType": 0,
			"IsStale": false,
			"HasAlias": false,
			"NumberOfElements": 0,
			"CollectionDisabled": false,
			"LastModified": 1496992712,
			"LastModifiedString": "2017-06-09T07:18:32Z"
			},
<SNIP>
	],
	"Links": {
		"first": "https://anilgwxb:8443/historian-rest-api/v1/tagslist?pageno=1&pagesize=4",
		"last": "https://anilgwxb:8443/historian-rest-api/v1/tagslist?pageno=258&pagesize=4",
		"prev": null,
		"next": "https://anilgwxb:8443/historian-rest-api/v1/tagslist?pageno=2&pagesize=4"
	}
}

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/100
https://<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/0
https://<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/100
https://<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/0
https://<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

Parameter Description Required? Values
TagNames Queries the specified tag names. Yes String
Start Start time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
End End time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
Direction Specifies the direction (Forward or Backward from the starting time) of data sampling from the archive. The default value is Forward (0). Yes Integer, with a value such as 0.
Count Count of archive values within each calculation interval. Yes Integer, with a value such as 100.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.
Data String Yes The 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  }
                ]
     }]
}

Interpolated Data API

The Interpolated Data API queries interpolated values for a list of tags. If the start time equals the end time, the request returns one sample.

METHOD: GET, POST
URI:
GET
https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/{tagNames}/{start}/{end}/{count}/{intervalMs}
POST
https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/{start}/{end}/{count}/{intervalMs}
SAMPLE GET URI: https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/tagName1/2013-10-02T11:30:00.111111Z/2013-10-02T11:31:11.111Z/100/10000
SAMPLE POST URI: https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/2013-10-02T11:30:00.111111Z/2013-10-02T11:31:11.111Z/100/10000
SAMPLE cURL COMMAND (GET): curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>http://<nodename>:8443/ historian-rest-api/v1/ datapoints/interpolated/<tagName>/<start time>/<end time>/<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>\}http://<nodename>:8443/ historian-rest-api/v1/ datapoints/interpolated/<start time>/<end time>/<count>/<intervalMS>

Query Parameters

Parameter Description Required? Values
TagName Queries the tag names specified. Yes String
Start Start time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
End End time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
Count Count of archive values within each calculation interval. Yes Integer, with a value such as 100.
intervalMS Interval in milliseconds. Yes 64-bit signed integer, with a value such as 10000.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.
Data String Yes The 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  }                 
                ]
     }]
}

Current Value API

The Current Value API queries the current value data and reads the current values for a list of tags. If the start time is equal to end time, the requiest returns one sample.

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/currentvalue
SAMPLE GET URI: https://<historianservername>:8443/historian-rest-api/v1/datapoints/currentvalue?tagNames=tagName1
SAMPLE POST URI: https://<historianservername>:8443/historian-rest-api/v1/datapoints/currentvalue
SAMPLE cURL COMMAND (GET): curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>http://<nodename>:8443/ historian-rest-api/v1/ datapoints/currentvalue/<tagName>
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>:8443/ historian-rest-api/v1/ datapoints/currentvalue

Query Parameters

Parameter Description Required? Values
TagNames Queries the specified tag names. Yes String

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.
Data String Yes The 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 = 2014-01-01T12:00:00Z, Value = 34.26155, and Quality = 3.

Sample Response

{
     "ErrorCode" : 0,
     "ErrorMessage": null,
     "Data":[{
      "DataType":"DoubleFloat",
      "ErrorCode":0,
      "TagName":"TagName1",
      "Samples":[ { "TimeStamp":"2014-01-01T12:00:00Z","Value":"34.26155","Quality":3 } ]
      }]
}

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

Parameter Description Required? Values
TagNames GE identifier for a location. Yes 1000000106
Start Start time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
End End time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
Count Count of archive values within each calculation interval. Yes Integer, with a value such as 100.
Calculation Mode End time in milliseconds. Yes Integer, with a value such as 1.
IntervalMS Interval in milliseconds. 64-bit signed integer, with a value such as 1000.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorCode String Yes For example, NULL.
Data String Yes The 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  } 
                ]
     }]
}

Sampled Data API

The Sampled Data API queries the sampled 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.

Note: For the query, you can also use optional parameters such as FilterMode and ReturnDataFields. Unused parameters can be omitted.
METHOD: GET, POST
URI:
GET
https://<historianservername>:8443/historian-rest-api/v1/datapoints/sampled
POST
https://<historianservername>:8443/historian-rest-api/v1/datapoints/sampled
SAMPLE GET URI: https://<historianservername>:8443/historian-rest-api/v1/datapoints/sampled?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/sampled
SAMPLE cURL COMMAND (GET): curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>http://<nodename>:8443/ historian-rest-api/v1/ datapoints/sampled/<tagName>/<start time>/<end time>/<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/sampled

Query Parameters

Parameter Description Required? Values
TagNames Queries the tag names specified. Yes String
Start Start time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
End End time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
SamplingMode Also known as SamplingModeType. Optional Integer, with a value such as 1.
CalculationMode Also known as CalculationModeType. Optional Integer, with a value such as 1.
Direction Specifies the direction (Forward or Backward from the starting time) of data sampling from the archive. The default value is Forward (0). Optional Integer, with a value such as 0.
Count The count of archive values within each calculation interval. Optional Integer, with a value such as 0.
IntervalMS Interval in milliseconds. Optional 64-bit signed integer, with a value such as 1000.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorCode String Yes For example, NULL.
Data String Yes The 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  } 
                ]
     }]
}

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

Parameter Description Required? Values
TagNames Queries the tag names specified. Yes String
Start Start time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
End End time of the query, in ISO data format (such as YYYY-MM-DDTHH:mm:ss.SSSZ). Yes DateTime
SamplingMode Also known as SamplingModeType. Optional Integer, with a value such as 1.
CalculationMode Also known as CalculationModeType. Optional Integer, with a value such as 1.
Direction Specifies the direction (Forward or Backward from the starting time) of data sampling from the archive. The default value is Forward (0). Optional Integer, with a value such as 0.
Count The count of archive values within each calculation interval. Optional Integer, with a value such as 0.
IntervalMS Interval in milliseconds. Optional 64-bit signed integer, with a value such as 1000.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.
Data String Yes The 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 }
	]}
}

Add Single Tag API

The Add Single Tag API provides the ability to add a new tag to Historian.

For the Add Single Tag API, you can add a new tag to Historian, and the tag name and data type must be provided in the payload (parameter) of the method. All other tags are optional. If a property is provided, the respective validation is performed at the server end. If the tag exists, then any new properties provided in the payload are applied to the existing tag.

METHOD: POST
URI: https://<historianservername>:8443/historian-rest-api/v1/tags/addtag
SAMPLE DELETE URI:
https://<historianservername>:8443/historian-rest-api/v1/tags/addtag

Payload:

{
    "Name" : "SampleTag",
    "DataType" : 3
}
SAMPLE cURL COMMAND: curl -i -H "Accept: application/json" -i -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>-d { \Name\:\Sampletag\,\"DataType\":3}-X POST https://<historianservername>:8443/historian-rest-api/v1/tags/addtag

Query Parameters

Parameter Description Required? Values
Payload JSON array of PropertyName and PropertyValue. Yes. "Name" and "DataType" properties are required. All other properties are optional. Multidata types. See Payload Parameter for a list of tag properties used to update a tag configuration.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.

Sample Payload

{
"Name" : "tag1",
"DataType" : 3 ,
"Id": "F34CFE80-7428-41A1-AC67-DB0F3D2E1146"
}

Sample Response

{
"ErrorCode": 0,
"ErrorMessage": null
}

Add Bulk Tags API

The Add Bulk Tags API provides the ability to add new tags to Historian using an array.

For the Add Bulk Tags API, you can add new tags to Historian using an array, and the tag names and data types must be provided in the payload (parameter) of the method. All other tags are optional. If a property is provided, the respective validation is performed at the server end. If the tags exist, then any new properties provided in the payload are applied to the existing tags. The payload is be an array of tags defined.

METHOD: POST
URI: https://<historianservername>:8443/historian-rest-api/v1/tags/addtags
SAMPLE DELETE URI:
https://<historianservername>:8443/historian-rest-api/v1/tags/addtags

Payload:

[
{
    "Name" : "SampleTag1",
    "DataType" : 3
},
{
    "Name" : "SampleTag2",
    "DataType" : 3
}
]
SAMPLE cURL COMMAND: curl -i -H "Accept: application/json" -i -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>-d [{ \Name\:\Sampletag1\}, { \Name\:\Sampletag2\}]-X POST https://<historianservername>:8443/historian-rest-api/v1/tags/addtags

Query Parameters

Parameter Description Required? Values
Payload JSON array tags with individual tags of PropertyName and PropertyValue. Yes. "Name" and "DataType" properties are required. All other properties are optional. Multidata types. See Payload Parameter for a list of tag properties used to update a tag configuration.

Response Parameters

Parameter Data Type Exists? Description
TagName String Yes Tag name.
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.

Sample Payload

[
  {
    "Name": "tag1",
    "Description": 1
  },
  {
    "Name": "tag2",
    "DataType": 3,
    "Description": 3
  }
]

Sample Response

[
  {
    "TagName": "Tag1",
    "ErrorCode": 10,
    "ErrorMessage": "Fail to validate the tag Tag1 error is 'Invalid data type'"
  },
  {
    "TagName": "Tag2",
    "ErrorCode": 0,
    "ErrorMessage": ""
  }
]

Update Tag Configuration API

You can use this API to update tag properties.

The Update Tag Configuration API allows you to set or modify any tag property values.

A Rename cannot be done using the Update Tag Configuration properties.

METHOD: PUT
URI: https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName
SAMPLE DELETE URI:
https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName

Payload:
{
    "PropertyName" : "PropertyValue"
}
SAMPLE cURL COMMAND: curl -i -H "Accept: application/json" -i -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>-d { \Description\:\SampleDesc\}-X PUT https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName

Query Parameters

Parameter Description Required? Values
tagName Tag name for which properties need to be set or modified. Yes String
Payload JSON array of PropertyName and PropertyValue. At least one property must be provided. Multidata types. See Payload Parameter for a list of tag properties used to update a tag configuration.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.

Sample Payload

{
     "Description" : "Test desc".
     "CollectionOffset" : 4294967295 
     }

Sample Response

{
"ErrorCode": 0,
"ErrorMessage": null
}

Get Tag Properties API

Use the Get Tags API to retrieve existing tag properties.

You can use this API to specify which properties are required for retrieval. If no property names are provided, then all properties are retrieved. When using the Get Tag Properties method, requesting a non-existent tag name returns an error.

METHOD: GET / POST
URI: (GET) https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName

This URI returns all tag properties.

URI: (POST) https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName
Payload

{
"PropertyName1" : 1,
"PropertyName2" : 1
}
SAMPLE GET URI: https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName
SAMPLE POST URI:
https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName

Payload:
{
    "Description" : 1
}
SAMPLE cURL GET COMMAND: curl -i -H "Accept: application/json" -i -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>-X GET https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName
SAMPLE cURL POST COMMAND: curl -i -H "Accept: application/json" -i -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>-d { \Description\: 1}-X POST https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName

Query Parameters

Parameter Description Required? Values
tagName Tag name for which properties need to be retrieved. Yes String
Payload JSON array of PropertyName and bool (true/false). At least one property must be provided. Multi data types. See Payload Parameter for a list of tag properties used to update a tag configuration.
Note: The query payload contains all the tag properties you want returned from the server. In the Update Tag Config method, you need to provide the actual tag property value. However, in the Get Tag Properties method, you need to provide the property and a value of 1 (true), to allow it to be read from the server and returned.

Response Parameters

Parameter Data Type Required? Description
ErrorCode Integer Yes For example, 0.
ErrorMessage String Yes For example, NULL.
Name String Optional If no error, then the tag name of query is returned and all requested parameters.

The response always includes these parameters.

Sample Response

{
  ErrorCode: 0,
  ErrorMessage: NULL,
    "Name": "AnilGH7-1.Simulation00001",
    "Description": "AnilGH7-1.Simulation00001",
    "EngineeringUnits": null,
    "Comment": null,
    "CollectorName": "ANILGH7-1_Simulation",
    "SourceAddress": "Simulation00001",
    "CollectionType": 2,
    "DataType": 2,
    "FixedStringLength": 8,
    "CollectionInterval": 1000,
    "CollectionOffset": 0,
    "LoadBalancing": false,
    "TimeStampType": 2,
    "HiEngineeringUnits": 200000,
    "LoEngineeringUnits": 0,
    "InputScaling": true,
    "HiScale": 32767,
    "LoScale": 0,
    "CollectorCompression": false,
    "CollectorDeadbandPercentRange": 0,
    "ArchiveCompression": false,
    "ArchiveDeadbandPercentRange": 0,
    "General1": null,
    "General2": null,
    "General3": null,
    "General4": null,
    "General5": null,
    "ReadSecurityGroup": null,
    "WriteSecurityGroup": null,
    "AdministratorSecurityGroup": null,
    "LastModified": "2016-08-31T10:34:37.749Z",
    "LastModifiedUser": "\\admin",
    "CollectorType": 2,
    "UTCBias": 0,
    "CalculationDependencies": [],
    "CollectionDisabled": false,
    "ArchiveCompressionTimeout": 0,
    "CollectorCompressionTimeout": 0,
    "SpikeLogic": true,
    "SpikeLogicOverride": false,
    "CollectorAbsoluteDeadbanding": false,
    "CollectorAbsoluteDeadband": 0,
    "ArchiveAbsoluteDeadbanding": false,
    "ArchiveAbsoluteDeadband": 0,
    "StepValue": false,
    "TimeResolution": 0,
    "ConditionCollectionEnabled": false,
    "ConditionCollectionTriggerTag": null,
    "ConditionCollectionComparison": 1,
    "ConditionCollectionCompareValue": null,
    "ConditionCollectionMarkers": true,
    "Calculation": "Simulation00001",
    "Id": "A4FD6A00-BE45-463F-93C9-F287F3220B31",
    "EnumeratedSetName": null,
    "DataStoreName": "User",
    "DefaultQueryModifiers": 0,
    "UserDefinedTypeName": null,
    "NumberOfElements": 0,
    "DataDensity": 4,
    "CalcType": 0,
    "HasAlias": false,
    "IsStale": false
}

The response always includes the Name field. The Calculation property is returned only when the tags interface type is 9 (S2S Collector type) tag.

Delete Tag API

This API allows a user to remove an existing tag from the Historian server.

The Delete Tag API provides the ability to delete an existing tag from the Historian server.

Its URI format supports question marks (?).

METHOD: DELETE
URI: https://<historianservername>:8443/historian-rest-api/v1/tags/tagName?{permanentDelete}
SAMPLE DELETE URI: https://<historianservername>:8443/historian-rest-api/v1/tags/tagName?permanentDelete=true
SAMPLE cURL COMMAND: curl -i -H "Authorization: Bearer <TOKEN>-X DELETE https:// <historianservername>:8443/historian-rest-api/v1/tags/tagName?permanentDelete=<true|false>

Query Parameters

Parameter Description Required? Values
tagName Name of the tag to be deleted. Yes String
permanentDelete Deletes the tag permanently from the Historian server if the value passed in is true. If the parameter is not provided, then permanentDelete is assumed to be false. Optional (false is default) Boolean, true or false

Response Parameters

Parameter Data Type Required? Description
ErrorCode Number Yes For example, ErrorCode=0, which means the operation was successful.
ErrorMessage String Yes For example, NULL.

Sample Response

{
     "ErrorCode": 0,
     "ErrorMessage": null, 
     }