question

testuser7-8288 avatar image
1 Vote"
testuser7-8288 asked KorrakutiParamesh-7839 answered

MS-graph API filter

Hello,

from graph-api point of view, I can pull up all the applications whose tags attribute has some literal string as shown below.

https://graph.microsoft.com/v1.0/applications?$filter=tags/any(s:s eq 'Request-number')


However, I can not do following.

https://graph.microsoft.com/v1.0/applications?$filter=tags/any(s:s startsWith 'Request-number')

Appreciate if you help me how can I pull up all the applications which have tag that start with Request-number.
Tags is nothing but collection of strings.
I do not know the full string but I do know it starts with 'Request-number'





Thanks.


azure-active-directory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RoderickBant74 avatar image
0 Votes"
RoderickBant74 answered RoderickBant74 commented

I'm not in an oppotunity to this right now, but I think the filter should have a little different syntax like: https://graph.microsoft.com/v1.0/applications?$filter=startsWith(tags/any(s:s, 'Request-number')

Please let me know if that works for you

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I did some more research and what you want to do does not seem to be supported in a single API call. This Graph documentation indicates that a filter with a startsWith clause is an advanced filter and that advanced filtering is only supported for the owner attribute of applications.

So I think you won't get around doing some filtering on the client side.


0 Votes 0 ·
KorrakutiParamesh-7839 avatar image
1 Vote"
KorrakutiParamesh-7839 answered

GET https://graph.microsoft.com/v1.0/applications?$filter=tags/any(c:c eq 'Request-number') worked fine for me.

Used the below Java code snippet to apply the filter on tags.

 ApplicationCollectionPage appPage = getGraphApiClient().applications().buildRequest()
                 .select("id,appId,identifierUris,appRoles,signInAudience")
                 .filter("tags/any(c:c eq 'application_type:resource_server')").get();



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.