The Historian REST API provides access to create and configure Datasets, create and configure Tags, and read and write Tag data.
API Documentation
The REST API documentation is available at:
http://<HistorianHostnameOrIPAddress>:4511/api/help
Authentication
For the Beta version, no authentication is required.
API Calls
The following REST API calls are available:
GET Datasets
GET
Datasets
URL http://<yourServerAddressHere>:4511/api/datasets
Returns an array of the configured datasets in the Real Time Historian with its purging rules.
Return Schema:
[
{
"n": "MQTT Data",
"pa": 7,
"ps": 0,
"s": 0.34553,
"c": 120,
"a": 7.342432
},
{
"n": "The Juice Factory",
"pa": 7,
"ps": 0,
"s": 0.34553,
"c": 120,
"a": 7.342432
}
]
- n - Name of the dataset (String)
- pa - Purge Age. Set in Days (Int 32)
- ps - Purge Size. Set in Gigs (Int 32)
GET Dataset
GET
Dataset
URL http://<yourServerAddressHere>:4511/api/datasets/{dataset}
Returns an object of the configured dataset in the Real Time Historian with its purging rules.
Return Schema:
{
"n": "The Juice Factory",
"pa": 7,
"ps": 0,
"s": 0.34553,
"c": 120,
"a": 7.342432
}
- n - Name of the dataset (String)
- pa - Purge Age. Set in Days (Int 32)
- ps - Purge Size. Set in Gigs (Int 32)
POST Dataset
POST
Dataset
URL http://<yourServerAddressHere>:4511/api/datasets/{dataset}
Updates an existing dataset in the Real Time Historian
Request Body:
{
"n": "The Juice Factory",
"pa": 14,
"ps": 0
}
- n - Name of the dataset (String) *required
- pa - Purge Age. Set in Days (Int 32) *required
- ps - Purge Size. Set in Gigs (Int 32) *required
GET Tags
GET
Tags
URL http://:4511/api/datasets/{dataset}/tags
Returns an array of tags stored within the particular dataset. Tags will be classified between System generated diagnostics tags and user generated tags in the response.
Each dataset will have "System Tags" and "User Tags". User tags are tags either stored by a collector or inserted by the API. "System Tags" are related to diagnostic information about process specific parameters and dataset activity, like read and write speeds etc. Please see this article explaining System Tags
Optional URL parameter:
contains - Filter criteria for tags to be returned (String)
Return Schema:
{
"n": "FL001.State",
"d": "Filler 1 State",
"u":
{
"0": "Idle",
"10": "Startup",
"20": "Running",
"21": "Bottle starvation",
"22": "Bottle jam",
"23": "Downstream bottleneck",
"30": "Cleaning"
},
"fl":
{
"Measure": "State",
"Product": "Juice",
"Area Code": "131",
"Equipment": "Filler",
"Equipment Number": "1"
},
"t": "System.Integer"
}
- n - Name of the tag (String)
- d - Description of the tag (String)
- f - Format of the value (String)
- u - Unit of Measure or State Enumeration (dictionary <Int32,String>)
- fl- Fields. Metadata associated with a tag (dictionary <String,String>)
- t - Data Type of the tag
POST Tags
POST
Tags
URL http://:4511/api/datasets/{dataset}/tags
Updates or creates an array of tags stored within the particular dataset. If the dataset does not exist, it will be created automatically.
Request Body:
[
{
"n": "string",
"d": "string",
"f": "string",
"u":
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"fl":
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"t": "string"
}
]
- n - Name of the tag (String) *required
- d - Description of the tag (String)
- f - Format of the value (String)
- u - Unit of Measure or State Enumeration (dictionary <Int32,String>)
- fl- Fields. Metadata associated with a tag (dictionary <String,String>
POST Tag
POST
Tag
URL http://:4511/api/datasets/{dataset}/tags/{tagname}
Updates or creates a tag stored within the particular dataset.
Request Body:
{
"n": "string",
"d": "string",
"f": "string",
"u":
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"fl":
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"t": "string"
}
- n - Name of the tag (String) *required
- d - Description of the tag (String)
- f - Format of the value (String)
- u - Unit of Measure or State Enumeration (dictionary <Int32,String>)
- fl- Fields. Metadata associated with a tag (dictionary <String,String>)
- t - Data Type of the tag
GET Tag Data
GET
Tag Data
URL http://:4511/api/datasets/{dataset}/data/{tagname}
Returns the data from the requested tag as stored in the referenced dataset.
Start and end time can either be supplied in standard ISO notation or UNIX format.
Relative time can also be specified for either start or end times.
If no times are specified in the request, the latest point will be returned.
If no end time is specified, it will default to "now".
Optional URL parameter:
start - Start timestamp to return data. ISO format
end - End timestamp to return data. ISO format
unixStart - Start timestamp to return data. UNIX Format
unixEnd - End timestamp to return data. UNIX Format
relativeStart - Relative start time i.e -2h
relativeEnd - Relative end time i.e -1h
Relative
time periods include:
y
- Years
M
- Months
d
- Days
h
- Hours
m
- Minutes
Return Schema:
{
"t":
{
"n": "Process.Memory",
"d": "Process memory usage",
"f": "0.0",
"u":
{
"1": "MB"
}
},
"s": "2024-10-02T16:12:58.716699Z",
"e": "2024-10-02T16:12:58.716699Z",
"d":
[
{
"t": "2024-10-02T16:12:53.643451Z",
"v": 615.0390625,
"q": 192
}
]
}
- t - tag object
- s - start time
- e - end time
- d - TVQ array of data
POST Tag Data
POST
Tag Data
URL http://:4511/api/datasets/{dataset}/data/{tagname}
Post array of TVQ values to a tag in a particular dataset.
Request Body:
[
{
"t": "2024-10-02T16:16:50.989Z",
"v": "string",
"q": 0
}
]
- t - timestamp
- v - value
- q - quality
POST Dataset Status
POST
Dataset Status
URL http://:4511/api/datasets/{dataset}/status
Post a TVQ value to mark the current status of a dataset. To be used to handle loss of comms etc.
Request Body:
[
{
"t": "2024-10-02T16:16:50.989Z",
"v": "string",
"q": 0
}
]
- t - timestamp
- v - value
- q - quality
Standard quality codes and values to be used include:
null
value and64
quality, collector's heartbeat has not been detected for 10 seconds, all collector's tags set toStore Forward
null
value and28
quality, collector has shutdownnull
value and24
quality, collector is communicating with the Historian, but the collector has lost communication with its data source