Historian REST APIs
Overview of the Historian REST APIs
- Tags List API: Provides a list of the current tags.
- Raw Data API: Queries raw data using a number of samples or a time range for a list of tags.
- Interpolated Data API: Queries interpolated data for a list of tags.
- Current Value API: Queries the current value data for a list of tags.
- Calculated Data API: Queries calculated data for a list of tags, using a number of samples or a time range for those tags.
- Sampled Data API: Queries sampled data using a number of samples or a time range for a list of tags.
- Trend Data API: Queries trend data for a list of tags.
- Add Single Tag API
- Add Bulk Tags API
- Update Tag Configuration API
- Get Tag Properties API
- Delete Tag API
Tags API
nameMask
.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:
|
Sample Response
{
"ErrorCode":0,
"ErrorMessage": null,
"tags": [
"ALT_SENSOR",
"tagName1",
"tagName2"
]
}
Tagslist API
The Tags List API GET
method retrieves the list of tags.
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 > |
If invalid, no data is returned. |
pagesize |
Integer | 128
Max Min |
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
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.
|
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
pageno
is ignored and pagesize
is defaulted to 128, all tags are considered:<baseurl>/v1/tagslist
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
tagid
- Stringtagname
- Stringdescription
- Stringdatatype
- Integercollectorname
- Stringcollectortype
- Integerdatastorename
- Stringegudescription
- Stringcomment
- Stringsourceaddress
- Stringsourceaddress
- Stringcollectioninterval
- Integercollectorcompression
- Booleanlastmodifieduser
- Stringenumeratedset
- Stringuserdefinedtypename
- Stringcalctype
- Integerisstale
- Booleanlastmodified
- Longlastmodified
- LonglastmodifiedString
String In readable formathas alias
- Booleannumberofelements
- Integercollectiondisabled
- Boolean
{
"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: |
|
SAMPLE GET URI: |
|
SAMPLE POST URI: |
|
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:
|
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: |
|
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:
|
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: |
|
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:
|
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: |
|
SAMPLE GET URI: |
|
SAMPLE POST URI: |
|
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:
|
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.
METHOD: | GET, POST |
URI: |
|
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:
|
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.
METHOD: | GET, POST |
URI: |
|
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:
|
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: |
|
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: |
|
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: |
|
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
|
SAMPLE GET URI: | https://<historianservername>:8443/historian-rest-api/v1/tags/properties/tagName |
SAMPLE POST URI: |
|
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. |
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,
}