0

I wanted to send an OData Query to Cumulocity. I got some documents pointing to the special format of query in the platform:

...&q=$filter%3D(c8y_Availability.status+eq+%27AVAILABLE%27)

By the way it is not working (for the list of alarms). Do you support OData-query? Can you provide me a sample for OData querying in cumulocity?

Parda
  • 31
  • 5

1 Answers1

1

Have a look here: http://cumulocity.com/guides/reference/inventory/#query-language

There are examples at the bottom of the section.

Hint: You can also peek into Chrome Developer Tools while editing the filters of the device list in the device management application. Your above example looks like this in the developer tools:

https://demos.cumulocity.com/inventory/managedObjects?currentPage=1&pageSize=100&q=$filter%3D(c8y_Availability.status+eq+%27AVAILABLE%27)&withGroups=true&withTotalPages=true

... and this looks quite much like the example you had above.

André
  • 668
  • 6
  • 11
  • So, does it work only on "managedObjects"? Maybe that is the reason. Because I want to filter "alarms" with my new-defined attributes and the OData filter doesn't work. – Parda Oct 15 '18 at 11:46
  • Yes, that's correct. You cannot use OData on other data types currently. That would cause a performance problem. – André Oct 16 '18 at 15:33
  • I checked the ODATA query on "managedObjects" with another type (no device) and it does not work! So you have filtering only for "managedObjects" with the "device" type. Is it really that limited? – Parda Feb 19 '19 at 14:24
  • I guess it's too late for you @Parda but maybe it helps others: you can also filter for non-device ManagedObjects. But then you have to use the "query" query parameter: {{url}}/inventory/managedObjects?query=%24filter%3D((has(com_example_Fragment)) – goflo Nov 03 '20 at 15:02