Insights Hub How to deal with time aligned error while calling GET IoT Time Series (TS) Aggregates Service API

2020-11-30T19:27:20Z
APIs & Services

Summary


Details

Getting time aligned error while calling GET IoT Time Series (TS) Aggregates Service API:-

Eg:-

https://gateway.eu1.mindsphere.io/api/iottsaggregates/v3/aggregates/39defbf266404baeb7e602f22e7e429b/FF_EV?from=2019-10-31T22:00:00.000Z&to=2020-10-31T22:00:00.000Z&select=TOTAL_BIOMASS_NO_BASED_TK1.average&intervalUnit=month&intervalValue=1 

Response: 

 

{

    "timestamp": "2020-10-07T07:43:08.052Z",

    "status": 400,

    "error": "Bad Request",

    "message": "[6009] Start time[2019-10-31T22:00:00Z] is not interval aligned[2019-09-30T22:00:00Z].",

    "path": "/api/iottimeseries/v3/aggregates/39defbf266404baeb7e602f22e7e429b/FF_EV"

}

Solution

Aggregate V3 API requires time alignment as per certain specific standards. If this standard is not followed customer can get such kind of issues.

The solution for this is to use IoT Time Series (TS) Aggregates Service Version 4.x  API's which are intelligent to handle the time alignment problems. To be more specific the aggregate V4 API internally handles time alignment and gives the proper output to the customer.

The IoT Time Series (TS) Aggregates Service Version 4.x has the capability to handle time zone related requests and able to handle such an error:-

Get:- https://sgpdfhub-fleetmanager.eu1.mindsphere.io/api/iottsaggregates/v4/aggregates?intervalUnit=month&intervalValue=1&to=2020-10-31T22:00:00.000Z&from=2019-10-31T22:00:00.000Z&assetId=39defbf266404baeb7e602f22e7e429b&aspectName=FF_EV


Notes

KB Article ID# PL8520681

Contents

SummaryDetails

Associated Components

IoT TS Aggregates Service