Filtering is performed by passing the
$filter query parameter in the OData spec. Filtering can also be done on nested objects by using a / to identify the child relationship.
Following are examples for odata filtering with catalog get requests API:
- Filter based on requestCompletion/requestCompletionState:
https://{{url}}/catalog-service/api/consumer/requests?$filter=requestCompletion/requestCompletionState+eq+'SUCCESSFUL'
- Filter by description:
https://{{url}}/catalog-service/api/consumer/requests?$filter=description eq 'test'
https://{{url}}/catalog-service/api/consumer/requests?$filter=(substringof('tes',tolower(description)))
- Filter by catalogItem/name:
Search full name https://{{url}}/catalog-service/api/consumer/requests?$filter=catalogItem/name eq 'bp1'
Search substring https://{{url}}/catalog-service/api/consumer/requests?$filter=(substringof('bp',tolower(catalogItem/name)))
- Filter by description and requestCompletion/requestCompletionState:
https://{{url}}/catalog-service/api/consumer/requests?$filter=(description eq 'test') and requestCompletion/requestCompletionState+eq+'SUCCESSFUL'
- Filter by description and catalogItem/name:
https://{{url}}/catalog-service/api/consumer/requests?$filter=(description eq 'test') and (catalogItem/name eq 'bp1')
- Filter using substringof and tolower for requestCompletion/requestCompletionState.
https://{{url}}/catalog-service/api/consumer/requests?$filter=substringof('failed',tolower(requestCompletion/requestCompletionState))
- Filter by Resource Action:
https://{{url}}/catalog-service/api/consumer/requests?$filter=(substringof('destroy',tolower(resourceAction/name))
https://{{url}}/catalog-service/api/consumer/requests?$filter=(substringof('lease',tolower(resourceAction/name))
- Filter by description, catalogitem, resourceAction/name, and resource/name:
https://{{url}}/catalog-service/api/consumer/requests?$expand=resource($filter=requestedBy eq '[email protected]' and ((substringof('lease',tolower(resourceAction/name))) or (substringof('bp1',tolower(resource/name))) or (substringof('bp1',tolower(catalogItem/name))) or (substringof('test',tolower(description)))))
For more information on $expand filter, see
Expand System Query.
Disclaimer: VMware is not responsible for the reliability of any data, opinions, advice, or statements made on third-party websites. Inclusion of such links does not imply that VMware endorses, recommends, or accepts any responsibility for the content of such sites.