【问题标题】:Is it possible to filter events by custom properties in Cumulocity是否可以通过 Cumulocity 中的自定义属性过滤事件
【发布时间】:2019-10-09 08:35:26
【问题描述】:

我在 Cumulocity 中插入具有自定义属性的事件。有没有办法通过自定义属性过滤事件?

【问题讨论】:

    标签: events filter cumulocity


    【解决方案1】:

    取决于“通过自定义属性过滤事件”是什么意思。如果您的意思是通过事件中的自定义“键”进行过滤,例如:

    {
      "text" : "my custom event",
      "type" : "event type",
      "id" : "c8yId",
      "time" : "time",
      "custom_key" : "specific value"
    }
    

    您可以使用请求中的“fragmentType”来使用 Cumulocity API。您可以通过发送“custom_key”作为过滤器来做到这一点:

    GET /event/events?fragmentType="custom_key" HTTP/1.1
    Host: tenant.cumulocity.com
    Authorization: Basic .....
    

    这将返回具有该特定键的所有事件。

    另一方面,如果您想通过具有“特定值”的自定义“键”进行过滤,您可以通过创建一个简单的微服务来完成此操作。在微服务中您发送相同的请求(如上),然后通过将“custom_key”的值与您要过滤的值进行比较来过滤结果,然后发送匹配的事件作为结果。

    希望对您有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      • 2021-11-16
      • 2012-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多