IIH Essentials API v.1.10 Get timestamp for calculate min/max

0
Hi,  I want to use IIH Essentials' DataService/Calculate endpoint with aggregation types MinWithTimestamp, MaxWithTimestamp, i.e. the following data sources: {     "dataSources": [         {             "id": "25ade90bb97649c09f4f4459127a4cb1",             "type": "Variable",             "aggregation": "MinWithTimestamp"         },         {             "id": "25ade90bb97649c09f4f4459127a4cb1",             "type": "Variable",             "aggregation": "MaxWithTimestamp"         } }   However, as stated in the Swagger Docs, there is no timestamp in the CalculationResult object.   When will the Min/MaxWithTimestamp operation be fully supported? Is there a current work around using IIH to receive the timestamp of the min / max? 
asked
2 answers
0

Hey,

We encountered the same issue and resolved it by using the CalculateTrend endpoint. For the calculationTimeRange, we used the difference between the 'to' and 'from' timestamps in milliseconds. This solution worked for IIH 1.8.

answered
0

Answer to my own question: you can use the CalculateTrend endpoint to get a response for the minimum that includes a timestamp. The key here is to set the calculationTimeRange to the length of the window = millisecondsBetween($to, $from).

E.g. 

{
    "from": "2024-05-29T15:00:00.000Z",
    "to": "2024-05-29T16:00:00.000Z",
    "calculationTimeRange": 3600000,
    "dataSources": [
        {
            "id": "869907b49f344d66808596306348d1e6",
            "type": "Variable",
            "aggregation": "MinWithTimestamp"
        }
    ]
}

to get a response:

[
    {
        "dataSource": {
            "id": "869907b49f344d66808596306348d1e6",
            "type": "Variable",
            "aggregation": "MinWithTimestamp"
        },
        "values": [
            {
                "timestamp": "2024-05-29T15:37:42.8203380Z",
                "value": 0
            }
        ]
    }
]

Make sure to use aggegation "MinWithTimestamp" as "Min" will on trend only returns the end of the time window as timestamp

answered