Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

How to filter results of an HTTP request?

(1) ShareShare
ReportReport
Posted on by 161
Hi, I have an HTTP Graph request which gets all my Office 365 users. Now, I'd like to filter out those that don't have a specific email extension (.e.g. @contoso.onmicrosoft.com) since the HTTP request also returns users external to our tenant. So far I have used a Select action to select the display name and email address. But, how can I select only those objects which meet the email filter criteria? Thanks for your help.
  • misterpower Profile Picture
    misterpower 34 on at
    Re: How to filter results of an HTTP request?

    I ran into this topic while trying to find out how to filter HTTP REST requests in combination with Business Central. You can filter the results of your HTTP request by conforming to the API guidelines specified in the following documentation: https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#97-filtering.

     

    Your filter will look as below. In the query, use $filter as parameter instead of the fields. Your value will contain the complete REST filter string. 

     

    HTTP1.png

    When executed, it looks as following:

     

    HTTP2.png

  • colonel_claypoo Profile Picture
    colonel_claypoo 161 on at
    Re: How to filter results of an HTTP request?

    Hi @v-yamao-msft,

     

    thanks for your reply.

    Unfortunately, the HTTP action returns an object and thus I can't get the filter action to work.

     

    Doing:

    chrome_2019-01-09_13-06-29.png

    gives the following error:1.png

     

    Changing the expression to @contains(body('HTTP')['value']['mail'], 'com')

     

    I also tried putting the filter condition in the expression of the Select action but also to no avail:

     

    chrome_2019-01-09_13-11-28.pngchrome_2019-01-09_13-09-30.png

     

    There must be something I'm getting wrong that I'm not seeing.

    Any ideas?

     

    Thanks!

     

  • v-yamao-msft Profile Picture
    v-yamao-msft on at
    Re: How to filter results of an HTTP request?

    Hi @colonel_claypoo,

     

    Please just take a try with the data operations –Filter array action.

    Using this action could help reduce the number of objects in an array to a subset that matches the criteria you provide.

    Here is the doc for your reference:

    https://docs.microsoft.com/en-us/flow/data-operations#use-the-filter-array-action

     

    Best regards,

    Mabel

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard