从特定设备获取特定类型的最新事件

Get the latest events of a specific type from a specific device

有没有办法从特定设备获取特定类型的最新事件?到目前为止,我通过 myURL/event/events?source=<<ID>>&type=<<type>>.

查询了所有事件

或者有没有办法获取按创建时间排序的事件集合?这也可以解决我的问题

在文档中我只找到了 dateFromdateTo 这样的参数。但是,如果我不知道上次活动的时间范围怎么办?

语法为:/event/events?type={type}&source={source}。

有关可用端点的更多信息: 获取/平台

支持团队的回答:

currently there is no way to revert the order of events. Besides dateFrom and dateTo you can also use creationFrom and creationTo. This will take the creationTime (server side timestamp when event was created) instead of the time (that is send within the event) But the order will still be oldest -> newest.

Best approach currently would be to use a good estimated time range (so you don't end up with 0 events in the response) where the dateTo/creationTo is in the future. If you add to the query params withTotalPages=true the result will give you the total pages in the statistics part.

Knowing the total pages you can you can do the query again but with currentPage=XX instead of withTotalPages=true and take the last element.

We have this functionality on measurements and audits where you can add the parameter revert=true. I will add an improvement that we extend this to the other APIs but at the moment you are limited to the workaround.

您只能将 dateFrom 参数和 pageSize 设置为 1,如下所示:&pageSize=1&dateFrom=1970-01-01。截至 2017 年 9 月,这是 returns 最近的事件。