I have some troubles with understanding the limitations of the IoT TS Aggregates API. My previous understanding was that a request without count, intervalUnit, and intervalValue would provide an “automatic” best-fit response.
However, I must be mistaken because the following example does not work for me and I do not know why. It would be great if someone from the community could clarify a bit such that I can handle this in my application.
curl --location --request GET 'https://gateway.eu1.mindsphere.io/api/iottsaggregates/v4/aggregates?assetId=5cf3c2a4cb1d49518f91a846af2dec97&aspectName=Gigafactory_Aging_storage_racks&from=2024-10-07T22%3A00%3A00.000Z&to=2024-10-08T08%3A53%3A52.635Z&select=Environment_Humidity' \
--header 'Authorization: Bearer {my_bearer_token}
Curl translation from Postman was a bit weird with the intervals, they are as following.
from=2024-10-07T22:00:00.000Z
to=2024-10-08T08:53:52.635Z
The response that I get is telling me that I should provide a value for count. However, similar requests works for timeIntervals that are both longer and shorter, e.g. 8 hours and 1 hour intervals.
Value null for request param 'count' is not aligned with IntervalTime
Link to limitations: IoT TS Aggregates Service v4.x - Developer Documentation - developer.siemens.com
@henrik.midtun InsightsHub community is available here: Siemens Digital Industries Software Community, there will probably be more people who can help.
I think it is something with your date formating / url encoding, If I try to use the mdsp command line to get aggregates it returns best fit:
1 Like
Thank you, darthsn0wcat for the link to the forum and your example.
I will cross-post after having checked the response with a different date format.
if you get the mdsp CLI to run, you can lift the URL it is using by setting DEBUG environment variable to *
or mindconnect
@henrik.midtun I am also getting the same error with the dates you specified with different asset and aspect, longer and shorter intervals work, this seems to be a problem somewhere in the implementation of the service
export from=2024-10-07T22:00:00.000Z
export to=2024-10-08T08:53:52.635Z
mdsp aggregates --assetid ba9361db82f4411297bdd8494ecb040f --aspectname Environment --from $from --to $to --select Humidity
Network error occured Bad Request {"errors":[{"code":400,"logref":"67078ef23481fd3b92a3ea28d564e786","message":"Value null for request param 'count' is not aligned with IntervalTime"}]}
Very helpful, thanks for following up!
I will post this in the IH community and hopefully a maintainer of the API will provide a detailed explanation or submit a bug report.
1 Like
I believe that the reason is that I was using seconds and milliseconds in my to and from fields. Adjusting the interval to a neat minute worked for me.
Also having an “exact” period between the from and to, i.e., using the same second and millisecond values works.
from=2024-10-07T22:00:01.100Z
to=2024-10-08T08:52:01.100Z
This topic has been posted to as well: Siemens Digital Industries Software Community
1 Like