Common API Parameters

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.

TagNames Parameter

By default, the Historian REST service provides support to read samples for multiple tags. Multiple tag names are separated by semicolons (;). For example, "tagname1;tagname2;tagname3".
https://<historianservername>:8443/historian-rest-api
/v1/datapoints/currentvalue?tagNames=tagName1;tagname2;tagname3

Encode the semicolon as %3B if using the URI format, as the semicolon is also a valid character for a Historian name, and the web service parses the tag names incorrectly if a tag name contains a semicolon.

Start and End Timestamps Parameter

For the Start and End Timestamps parameter, the Timestamp format in the URI must be in ISO data format, such as YYYY-MM-DDTHH:mm:ss.SSSZ.

EPOCH time (standard base time) is only valid in the JSON-format request body or response body, such as \/Date(928167600000-0500)\/. If you use the same timestamp for start and end timestamps, the request returns a single result.

All timestamps passed to the REST service must be formatted as UTC timestamps.

Object Name Description
StartTime Start time of the query. This represents the earliest timestamp for any tag contained in the query.

If no StartTime is specified, the start time is two hours prior to running the query.

EndTime End time of the query. This represents the latest timestamp for any tag contained in the query.

If no EndTime is specified, the end time is the time that the query runs.

TagSamples Parameter

The TagSamples parameter is the output from the REST API calls.
Property Name Property Type Description
TagName String Name of the tag.
DataType String Tag Data Type Value:
  • Blob Stores tags as binary large objects. The Blob datatype generally refers to undetermined binary data types, such as an Excel spreadsheet, a PDF file, or a Word file.
  • Boolean (one byte) Stores boolean values. Valid values for the boolean data type are 0=FALSE and 1=TRUE. If the user sends zero, the value is taken as zero. Anything other than zero, the value is treated as one.
  • Byte (one byte) Stores integer values. Valid values for the byte data type are -128 to +127.
  • SingleFloat (four bytes) Stores decimal values up to six places. Valid ranges for the single float data type are 1.175494351e-38F to 3.402823466e+38F
  • DoubleFloat (eight bytes) Stores decimal values up to 15 places. Valid values for the double float data type are 2.2250738585072014e-308 to 1.7976931348623158e+308.
  • SingleInteger (two bytes) Stores whole numbers, without decimal places. Valid values for the single integer data type are -32767 to +32767.
  • DoubleInteger (four bytes) Stores whole numbers, without decimal places. Valid values for the double integer data type are -2147483648 to +2147483648.
  • FixedString (Configured by user) Stores string data of a fixed size. Valid values are between 0 and 255 bytes.
  • Float Single float.
  • Integer Single integer.
  • MultiField Stores string data that has multiple words.
  • QuadInteger (eight bytes) Stores whole numbers without decimal places. Valid values for the quad integer data type are -9,223,372,036,854,775,808 (negative nine quintillion) to +9,223,372,036,854,775,807 (positive nine quintillion).
  • Scaled (two bytes) Lets you store a four-byte float as a twobyte integer in the Historian archive. The scaled data type saves disk space but sacrifices data precision as a result.
  • Time Returns or sets the type of time stamping applied to data at collection time.
  • UDoubleInteger (Unsigned Double Integer) (four bytes) Stores whole numbers without decimal places. Valid values for the unsigned double integer data type are 0 to 4,294,967, 295 (4.2 billion).
  • Undefined Data type is not defined.
  • UQuadInteger (Unsigned Quad Integer) (eight bytes) Stores whole numbers without decimal places. Valid values for the unsigned quad integer data type are 0 to 18,446,744,073,709,551,615 (19 quintillion).
  • USingleInteger (Unsigned Single Integer) (two bytes) Stores whole numbers without decimal places. Valid values for the unsigned single integer data type are 0 to 65535.
  • VariableString (No fixed size) Stores string values of undetermined size. This data type is useful if you cannot rely on a constant string length from your data source.
  • Array Returns an array of tags from your data source. You can specify orientation, size, and number of rows returned in the array.
ErrorCode Error Code Error Code Definition

See Error Code Definition for more information.

Samples Data Sample See DataSample Parameter for more information.

DataSample Parameter

The DataSample Parameter specifies the number of data samples to retrieve from the archive. Samples are evenly spaced within the time range defined by start time and end time for most sampling modes.
Property Name Property Type Description
Value String Format for a multi-field tag like { "field1":"1","field2":"1000.0" } (user-defined type tag).

JavaScript code can parse the value string as a JSON object. All field values are string.

TimeStamp DateTime Start and end times of the query. If no start time is specified, the start time is two hours prior to running the query. If no EndTime is specified, the end time is the time the query runs.
Quality Integer

(Enumerated value of DataQuality.StatusType)

Data type consisting of a set of named values called elements, members or enumerators of the type. Property values reflect quality as "quality is good" or " quality is bad".
Value and Status
  • 0 Bad
  • 1 Uncertain
  • 2 NA
  • 3 Good

SamplingModeType Parameter

The SamplingModeType parameter is the mode of sampling data from the archive. The default setting for the Sampling Mode is Calculated.
Properties Description Value
Undefined Sampling mode is not defined. 0
CurrentValue Retrieves the current value. The time- interval criteria are ignored. 1
Interpolated Retrieves evenly-spaced, interpolated values based on interval or NumberOfSamples and the time-frame criteria. 2
Trend Returns the raw minimum and raw maximum value for each specified interval. Use the Trend sampling mode to maximize performance when retrieving data points for plotting. For the Trend sampling mode, if the sampling interval does not evenly divide by the interval length, Historian ignores any leftover values at the end, rather than putting them into a smaller interval. 3
RawByTime Retrieves raw archive values based on time-frame criteria. 4
RawByNumber Retrieves raw archive values based on the StartTime criteria, the NumberOfSamples, and Direction criteria. The EndTime criteria is ignored for this sampling mode. 5
Calculated Retrieves evenly spaced calculated values based on NumberOfSamples, interval, the time frame criteria, and the CalculationMode criteria. 6
Lab Returns actual collected values without interpolation. 7
InterpolatedtoRaw Provides raw data in place of interpolated data when the number of samples are fewer than the available samples. 8
TrendtoRaw The TrendtoRaw sampling mode almost always produces the same results as the Trend sampling mode. However, when more samples are requested than there are raw data points, the TrendtoRaw sampling mode returns all available raw data points with no further processing. Use TrendtoRaw in place of Trend when this condition exists. 9
LabtoRaw Provides raw data for the selected calculated data, when NumberOfSamples is less than the available samples. 10
RawByFilterToggle Returns filtered time ranges using the following values:
  • 1 true
  • 0 false

This sampling mode is used with the time range and filter tag conditions. The response string starts with a starting time stamp and ends with an ending timestamp.

11

Direction Parameter

The Direction Parameter specifies the direction (Forward or Backward from the starting time) of data sampling from the archive. The default value is Forward.
Direction Value
Forward 0
Backward 1

CalculationModeType Parameter

The CalculationModeType parameter is only applied if the Sampling Mode is set to Calculated. It represents the type of calculation to use on the archive data. The default Calculation Mode, if none is specified, is Average.
Calculation Mode Type Description Value
Undefined Calculation mode is not defined. 0
Average Retrieves the time-weighted average for each calculation interval. 1
StandardDeviation Retrieves the time-weighted standard deviation for each calculation interval. 2
Total Retrieves the time-weighted rate total for each calculation interval.

Use rate totals when working with a continuous measurement. Time weighting takes into account that compressed data is not evenly spaced in time. A factor must be applied to the total value to convert into appropriate engineering units. As a rate total, the default is Units/Day. If the actual units of the continuous measurement are Units/Minute, you would multiply the results by 1440 (minutes per day) to convert the total into appropriate engineering units.

3
Minimum Retrieves the minimum value for each calculation interval. 4
Maximum Retrieves the maximum value for each calculation interval. 5
Count Counts the number of raw samples found with good quality in the interval.

Value is the count of raw samples with good quality in the interval. The values of each sample are ignored. The Count does not include any samples of bad quality, including the start and end of collection markers.

For Quality, the percentage of good samples is always 100, even if the interval does not contain any raw samples, or contains only bad quality samples.

Count is useful for analyzing the distribution of the raw data samples to determine the effect of compression deadbands. It is also useful to determine which tags are consuming the most archive space.

6
RawAverage Retrieves the arithmetic average of all good quality raw samples for each calculation interval.

Value is the sum of all good quality samples in the interval, divided by the number of good quality samples in the interval. All bad quality samples are ignored. That is RawAverage is equivalent to RawTotal divided by the Count.

For Quality, if there are no raw samples in the interval or if they all are bad quality, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples.

RawAverage is useful for calculating an accurate average when a sufficient number of raw samples are collected.

7
RawStandardDeviation Retrieves the arithmetic standard deviation of raw values for each calculation interval.

For Value, any raw point of bad data quality is ignored.

For Quality, if there are no raw samples in the interval or they all have bad quality, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples.

RawStandardDeviation is useful for calculating an accurate standard deviation when a sufficient number of raw samples are collected.

8
RawTotal Retrieves the arithmetic total (sum) of sampled values for each interval.

Value is the sum of the good quality values of all raw samples in the interval. All bad quality samples are ignored.

For Quality, the percentage of good samples is always 100, even if the interval does not contain any raw samples or it contains only bad quality samples.

If the same start and end times are used, and the time span is treated as a single interval, then all values are added together.

RawTotal is useful for calculating an accurate total when a sufficient number of raw samples are collected. Note that unlike ihTotal, this is a simple sum with no assumption that the values are rate values.

9
MinimumTime Retrieves the timestamp of the minimum value found within each calculation interval. It can be a raw or an interpolated value. The minimum must be a good data quality sample. 10
MaximumTime Retrieves the timestamp of the maximum value found within each calculation interval. It can be a raw or an interpolated value. The maximum must be a good data quality sample. 11
TimeGood Retrieves the amount of time (milliseconds) during the interval when the data is of good quality and the filter condition is met. 12
StateCount Retrieves the amount of time a tag uses to transition to another state from a previous state during a time interval. 13
StateTime Retrieves the duration that a tag stayed in a given state within an interval. 14
OPCQAnd Retrieves the OPCQAND, bit-wise AND operation of all the 16-bit OPC qualities of the raw samples stored in the specified interval.

Note that OPC Quality is a subfield for Quality-Value-Timestamp (QVT), so when this calculation mode is used, OPC Quality is considered for calculation.

15
OPCQOr Retrieves the OPCQOR, bit-wise OR operation of all the 16-bit OPC qualities of the raw samples stored in the specified interval.

Note that OPC Quality is a subfield for Quality-Value-Timestamp (QVT), so when this calculation mode is used, OPC Quality is considered for calculation.

16
FirstRawValue Retrieves the first good raw sample value for a given interval.

Value is the value of the raw sample, or zero if there are no good raw samples in the interval.

For Quality, if there are not good raw samples in the interval, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples. Note that Quality is the same for FirstRawValue and FirstRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

17
FirstRawTime Retrieves the first good raw timestamp for a given interval.

Value is the timestamp of the sample or the year 1969 if there are no good raw samples in the interval.

For Quality, if there are not good raw samples in the interval, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples. Note that Quality is the same for FirstRawValue and FirstRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

18
LastRawValue Retrieves the last good raw sample value for a given time interval.

Value is the value of the raw sample or zero if there are no good raw samples in the interval.

For Quality, if there are no good raw samples in the interval, the the percentage of good samples is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad samples. Note that Quality is the same for LastRawValue and LastRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

19
LastRawTime Retrieves the last good timestamp of the last value for a given time interval.

Value is the timestamp of the sample or the year 1969 if there are no good raw samples in the interval.

For Quality, if there are no good raw samples in the interval, the percentage of good samples is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad samples. Note that Quality is the same for LastRawValue and LastRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

20
TagStats Retrieves the statistics for a tag from the archive stored in the specified interval. 21

FilterModeType Parameter

The FilterModeType parameter defines how time periods before and after transitions in the filter condition should be handled.

When the FilterModeType parameter is applied, then the Start time and End time are specified as:

  • ExactTime
  • BeforeTime
  • AfterTime
  • BeforeAndAfterTime

For example, AfterTime indicates that the filter condition should be True starting at the timestamp of the archive value that triggered the True condition, and leading up to the timestamp of the archive value that triggered the False condition.

Properties Description Value
ExactTime Retrieves data for the exact times that the filter condition is True. 1
BeforeTime Retrieves data from the timestamp of the last False filter condition to the timestamp of the next True condition. 2
AfterTime Retrieves data from the timestamp of the True filter condition to the timestamp of the next False condition. 3
BeforeAndAfterTime Retrieves data from the timestamp of the last False filter condition to the timestamp of the next False condition. 4

ReturnDataFields Parameter

The ReturnDataFields bitwise parameter specifies which data fields are returned in a query. Using it in a query returns data such as TimeStamp, and each field returns a Boolean value.

Each time-series data sample contains QVT (quality, value, and timestamp) values. If ReturnDataFields is not provided, then the default value of 0 is considered, and all QVT values are returned for each data sample. To return one of the data field properties, such as TimeStamp, use the TimeStamp option as shown in the table.

Properties Description Field value (Boolean)
All Fields Specifies that all data fields are returned in the query. 0 (0000)
TimeStamp The time stamp of the collected sample or an interval time stamp. When specified in the query, returns the TimeStamp property. 1 (0001)
Value The collected value or sampled value; the data type of the value will be the same data type as the tag's raw data. 2 (0010)
Quality When specified in the query, returns the Quality property. Each sample in Current Value and Raw query retrieval has a quality of:
  • Good (3)
  • Not Available (2)
  • Uncertain (1)
  • Bad (0)

Interpolated and Lab Retrieval express quality as "percent good".

4 (0100)

Payload Parameter

This parameter queries for the tag properties requested from the server.

Use the Payload parameter to query for all the tag properties to return from the server. In the Update Tag Configuration API, you must provide the actual tag property value. However, in the Get Tag Properties API, you must provide the property name and value of 1 (true), so the property can be read from the server and returned.

The properties listed in the following table are valid in APIs that use the Payload parameter, unless otherwise specified. For Property Names used in the Get Tag Properties API, the property name is always a Boolean (true/false) value, while it can be a string or integer for other APIs.

Property Name Property Type Description
AllFields Boolean Used for Get Tag Properties API.
Name Boolean, String Used for the Get Tag Properties API, Add Single Tag API, and Add Bulk Tags API.
Description String
EngineeringUnits String
Comment String
DataType : ihDataType SignedIntegral Type definition is an enumerated type "ihDataType".
{
ihDataTypeUndefined = 0,
ihScaled,
ihFloat,
ihDoubleFloat,
ihInteger,
ihDoubleInteger,
ihFixedString,
ihVariableString,
ihBlob,
ihTime,
ihInt64,
ihUInt64,
ihUInt32,
ihUInt16,
ihByte,
ihBool,
ihMultiField,
ihArray,
ihMaxDataType
} ihDataType;
FixedStringLength UnsignedChar
CollectorName String
SourceAddress String
CollectionType : ihCollectionType SignedIntegral Type definition is an enumerated type "ihCollectionType".
{
ihUnsolicited = 1,
ihPolled
} ihCollectionType;
CollectionInterval SignedIntegral
CollectionOffset UnsignedLong
LoadBalancing Boolean
TimeStampType : ihTimeStampType SignedIntegral Type definition is an enumerated type "ihTimeStampType".
{
ihSource = 1,
ihInterface,
} ihTimeStampType;
HiEngineeringUnits Double
LoEngineeringUnits Double
InputScaling Boolean
HiScale Double
LoScale Double
CollectorCompression Boolean
CollectorDeadbandPercentRange Float
ArchiveCompression Boolean
ArchiveDeadbandPercentRange Float
General1 String
General2 String
General3 String
General4 String
General5 String
ReadSecurityGroup String
WriteSecurityGroup String
AdministratorSecurityGroup String
LastModified Boolean Used for Get Tag Properties API.
LastModifiedUser Boolean Used for Get Tag Properties API.
InterfaceType Boolean Used for Get Tag Properties API.
CollectorType : ihInterfaceType SignedIntegral Type definition is an enumerated type "ihInterfaceType".
{
ihInterfaceUndefined = 0,
ihIFix,
ihRandom,
ihOPC,
ihFile,
ihIFixLabData,
ihManualEntry,
ihOther,
ihCalcEngine,
ihServerToServer,
ihPI,
ihOPCAE,
ihCIMPE,
ihPIDistributor,
ihCIMME,
ihPerfTag,
ihCustom,
ihServerToServerDistributor,
ihWindowsPerfMon,
} ihInterfaceType;
UTCBias SignedIntegral
AverageCollectionTime Boolean Used for Get Tag Properties API.
CalculationDependencies StringArray
CollectionDisabled Boolean
ArchiveCompressionTimeout UnsignedLong
CollectorCompressionTimeout UnsignedLong
SpikeLogic Boolean
SpikeLogicOverride Boolean
CollectorAbsoluteDeadbanding Boolean
CollectorAbsoluteDeadband Double
ArchiveAbsoluteDeadbanding Boolean
ArchiveAbsoluteDeadband Double
StepValue Boolean
TimeResolution : ihTimeResolution SignedIntegral Type definition is an enumerated type "ihTimeResolution".
{
ihSeconds = 0,
ihMilliseconds,
ihMicroseconds,
ihNanoseconds
} ihTimeResolution;
ConditionCollectionEnabled Boolean
ConditionCollectionTriggerTag String
ConditionCollectionComparison : ihConditionCollectionComparison SignedIntegral Type definition is an enumerated type "ihConditionCollectionComparison".
{
ihConditionComparisonUndefined = 0,
ihConditionComparisonEqual,
ihConditionComparisonLessThan,
ihConditionComparisonLessThanEqual,
ihConditionComparisonGreaterThan,
ihConditionComparisonGreaterThanEqual,
ihConditionComparisonNotEqual
} ihConditionCollectionComparison;
ConditionCollectionCompareValue String
ConditionCollectionMarkers Boolean
Calculation String When the Calculation field is used, then two more conditions are required. Calculation is not a specific field for a tag property. If the tag's collector or interface type is Server-to-server and the Calculation field is set (not Null), then the field value is set to the source address.
TagId Boolean Used for Get Tag Properties API.
EnumeratedSetName String
DataStoreName String
DefaultQueryModifiers Long Long
UserDefinedTypeName String
NumberOfElements SignedIntegral
DataDensity : ihTagDataDensity SignedIntegral Type definition is an enumerated type "ihTagDataDensity".
{
ihDataDensityUndefined = 0,
ihDataDensityMinimum = 1,
ihDataDensityMedium = 4,
ihDataDensityMaximum = 7
} ihTagDataDensity;
CalcType : ihTagCalcType SignedIntegral Type definition is an enumerated type "ihCalcType".
{
ihRawTag = 0,
ihAnalyticTag = 1,
ihPythonExprTag = 2
} ihTagCalcType;
HasAlias Boolean Used for Get Tag Properties API.
IsStale Boolean Used for Get Tag Properties API.

Error Code Definitions

The following table provides the values and definitions for the ErrorCode parameter.
Table 1. Error Code Definitions
Error Code Value: Error Code Definition
Success = 0 Operation successful.
Failed = -1 Operation failed.
Timeout = -2 Operation failed due to timeout.
NotConnected = -3 Not connected to Historian server.
CollectorNotFound = -4 The given collector does not exist on the server.
NotSupported = -5 Operation not supported.
DuplicateData = -6 Attempt to overwrite an existing data sample.
InvalidUsername = -7 Bad user name or password.
AccessDenied = -8 Insufficient permissions for operation.
WriteInFuture = -9 Attempted data write too far in the future.
WriteArchiveOffline = -10 Attempted data write to an offline archive.
WriteArchiveReadonly = -11 Attempted data write to a read-only archive.
WriteOutsideActiveRange = -12 Attempted data write beyond the configured active range.
WriteNoArchiveAvailable = -13 Attempted data write with no available archives.
InvalidTagname = -14 The requested tag was not found.
LicensedTagCountExceeded = -15 Number of licensed tags exceeded.
LicensedConnectionCountExceeded = -16 Number of licensed server connections exceeded.
InternalLicenseError = -17 Internal license error.
NoValue = -18 No available tag data.
DuplicateCollector = -19 The given collector name already exists on the server.
NotLicensed = -20 Server or feature is not licensed.
CircularReference = -21 Circular reference detected in calculation.
BackupInsufficientSpace = -22 Insufficient disk space to perform backup.
InvalidServerVersion = -23 Operation unsupported due to server version.
QueryResultSizeExceeded = -24 Upper limit on query results exceeded.
DeleteOutsideActiveRange = -25 Attempted data delete outside allowed modification interval.
AlarmArchiverUnavailable = -26 Alarm and Event subsystem unreachable.
ArgumentException = -27 A supplied argument is invalid.
ArgumentNullException = -28 A supplied argument is NULL.
ArgumentOutOfRangeException = -29 A supplied argument is outside the valid range.
InvalidEnumeratedSet = -30 The requested Enumerated Set was not found.
InvalidDataStore = -31 The requested data store was not found.
NotPermitted = -32 Operation not permitted.
InvalidCustomDataType = -33 The Custom data type is not supported.
ihSTATUS_EXISTING_USERDEF_REFERENCES = -34 N/A
ihSTATUS_INVALID_TAGNAME_DELETEDTAG = -35 N/A
ihSTATUS_INVALID_DHS_NODENAME = -36 N/A
ihSTATUS_DHS_SERVICE_IN_USE = -37 N/A
ihSTATUS_DHS_STORAGE_IN_USE = -38 N/A
ihSTATUS_DHS_TOO_MANY_NODES_IN_MIRROR = -39 N/A
ihSTATUS_ARCHIVE_IN_SYNC = -40 N/A
InvalidArchiveName= -41 N/A
InvalidSession = 1 Session id is invalid.
SessionExpired = 2 Session has expired.
UnknownError = 3 Unknown error, please check server log.
NoValidClientBufferManager= 4 No valid client buffer manager.
NoValueInDataSet = 5 No value in returned data set.
TagNotExisting = 6 Tag doesn't exist.
ClientBufferManagerCommunicationError = 7 Service call to central buffer server fail.
TagTypeNotSupported=8 Tag type is not supported.
ValueTypeNotMatchTagDataType = 9 Value type doesn't match tag data type.
InvalidParameter=10 Invalid query parameter.
TagSearchResultIsHuge = 11 Tag Search Criteria result was more than 5000.
InvalidHistorianServer=12 No valid server or historian server name isn't in the server list.