VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso

vRA 8 api filter on project return members containing a specified group

I'm trying to put together a filter on the request to /project-service/api/projects where it only grabs items where one of the members items is of type: group and the email is equal to a group I'm filtering on.  Hoping there is a way for this complex filter to be applied in the call and not need to filter on the results of all the projects getting returned.  I've put together plenty of simple filters but not tried on an array of objects.

0 Kudos
2 Replies
emacintosh
Hot Shot
Hot Shot

Not sure how accurate it is, but according to the Swagger docs, it looks like the filter functions all take strings (/iias/api/projects).  You may be stuck looping through.  Is it that you have so many projects you don't want to loop?  Or that you don't want to or have the ability to actually write code wherever you're using this?

 

Filter the results by a specified predicate expression. A set of operators and functions are defined for use:
Operators: eq, ne, gt, ge, lt, le, and, or, not.
Functions:
bool substringof(string p0, string p1)
bool endswith(string p0, string p1)
bool startswith(string p0, string p1)
int length(string p0)
int indexof(string p0, string p1)
string replace(string p0, string find, string replace)
string substring(string p0, int pos)
string substring(string p0, int pos, int length)
string tolower(string p0)
string toupper(string p0)
string trim(string p0)
string concat(string p0, string p1)

 

0 Kudos
qc4vmware
Virtuoso
Virtuoso

So it looks like the filter I need is the "any or all" type which I guess is not supported.

$filter=members/any(p: p/email eq 'somename')

I'd like to be able to have this all in a simple rest call for many reasons.  In the meantime I guess I can front end this with a vRO action of some sort and do the additional filtering.  I'd like efficiency as well as less development work if it could just be included in the query.  vRA throws an error about this not being a supported aggregate query or something like that.

0 Kudos