pythonresthistorianproficy

GE Proficy Historian REST API: StateTime Calculated API


I have a python script that I would like to use to query the GE Proficy Historian Calculated REST API, particularly the 'StateTime' calculated function. However in none of the documentation it states what is the parameter name to pass as the value I would like to count/compare with in the query.

Looking at the documentation, it comes up as a calculation option, however nowhere does it state what is the parameter name to pass into my API GET request to determine how long my tag was at the defined value I'd like:

GE Proficy Rest API Calculation Modes

Below is a my code snippet calling the API, what will be the param name be for what value I want the API to determine the time the tag was at that value. Currently the code snippet just returns 0 as the value:

base_url= "https://<server_name>:8443/historian-rest-api/v1/datapoints/calculated"

params = {
    "tagNames": "TagName",
    "start": "2025-04-17T19:00:00-04:00",
    "end": "2025-04-17T23:00:00-04:00",
    "samplingMode": 6,
    "calculationMode": 14,
    "direction" : 0,
    "count": 1,
    "intervalMs" : 100000,
}


response = requests.get(base_url, headers=headers, params=params, verify=False)

if response.ok:
    print(response.json())
else:
    print(response.status_code, response.text)

Thank you!


Solution

  • I have gotten a response from GE support, they have removed StateTime/StateCount from their REST API in the new versions of proficy. However they never removed it from their documentation.........