VMware {code} Community
kylejw
Contributor
Contributor

API response filtering with Odata

Hello,

 

This question is about filtering in the various vmware APIs using Odata.

In case it's relevant, I'm specifically attempting to use the IaaS API to find fabric networks with specific tags. 

 

It seems to me that I should be able to use this query string:

?$filter=tags/any(t:t/key eq 'key1' and t/value eq 'value1')

to find a fabric network with tag key1:value1

(of course, URI encoding the string prior to sending).

 

However when I issue a request with this query, I receive an HTTP 400 response.  In fact, I cannot seem to use the any() operator, or slashes '/' to access nested properties, at all.

The only thing I can do is something like this:
?$filter=tags.item.key eq 'key1' and tags.item.value eq 'value1'

 

This does not seem to line up with Odata examples I'm finding online.  And I cannot do complex queries this way.  Is there any good comprehensive documentation on how to use $filter?  Am I doing something wrong?

 

Thanks

0 Kudos
0 Replies