web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate - Combi...
Power Automate
Unanswered

Power Automate - Combine 2 or more http responses

(0) ShareShare
ReportReport
Posted on by 25

Hi - hoping that someone can help with the following:

I have an http request that returns more that 999 items:

https://graph.microsoft.com/v1.0/users?$select=displayName,id,officeLocation,assignedLicenses,licenseAssignmentStates&$top=999&$count=true&$filter=startswith(officeLocation,'TEST')

Ultimately, the data will be sent back to a canvas app as text using "Respond to a PowerApp or flow".

I have read and testing combining the 2 replies using pagination information, selecting the specific information that I need, and looping through the results adding each to an array.   The concern, as I have also seen others mention, is that appending to array can take a considerable amount of time.  In my case, ~ 2 minutes for each 999 records.  [I already set the speed option to 50]

 

Questions:

Is there a fast way to combine 2 or more HTTP responses without appending to array

Is there a way to get more than 1000 records for the http request mentioned above?  In my case, I am using just a free Http connector

 

 

 

Categories:
I have the same question (0)
  • adedapo Profile Picture
    256 on at

    Does this result come in an array? Or maybe post a sample of the result

  • jim_beam Profile Picture
    25 on at

     

    Hi



    Thank you for the reply.  A sample below showing that the results do come in an array. Sample below shows 1 name.
    I need to pull 1500 names which exceeds the 1000 limit and hence the need to concat 2 http responses


    {
      "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(displayName,id,officeLocation,assignedLicenses,licenseAssignmentStates)",
      "@odata.count": 659,
      "@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$select=displayName%2cid%2cofficeLocation%2cassignedLicenses%2clicenseAssignmentStates&$top=9&$count=true&$filter=startswith(officeLocation%2c%Test%27)&$skiptoken=0000",
      "value": [
        {
          "displayName": "Jim_Beam",
          "id": "000",
          "officeLocation": "Test",
          "assignedLicenses": [
            {
              "disabledPlans": [],
              "skuId": "000"
            },
            {
              "disabledPlans": [],
              "skuId": "000"
            },
            {
              "disabledPlans": [],
              "skuId": "000"
            },
            {
              "disabledPlans": [],
              "skuId": "0000"
            }
          ],
          "licenseAssignmentStates": [
            {
              "skuId": "000",
              "disabledPlans": [],
              "assignedByGroup": "ggg",
              "state": "Active",
              "error": "None",
              "lastUpdatedDateTime": "2001-08-22T17:14:42.6958845Z"
            },
            {
              "skuId": "000",
              "disabledPlans": [],
              "assignedByGroup": "0000",
              "state": "Active",
              "error": "None",
              "lastUpdatedDateTime": "2001-05-12T19:27:10.0947329Z"
            }
          ]
        }
      ]
    }

     

  • Verified answer
    adedapo Profile Picture
    256 on at

    Okay, you can use the union function in a Compose action

    union(outputs('Your_Graph_Action')[0]['value'],outputs('Your_Graph_Action')[1]['value'])

    If you are not sure about the number of pages your results will contain (or you want to account for any number of pages), then it gets a little bit more complicated.

    First, compose a unique string using the  GUID function. This will come in handy later.
    Second, use the Select action to extract all the value arrays (each page will have a value array) from the results. Here you switch the Map to text mode and add

    item()['value']

    adedapo_0-1676535352805.png

    FInally, add this expression to a compose action to combine the arrays.

    json(
     replace(
     join(body('Your_select_action'),outputs('ComposeGUID')),
     concat(']',outputs('ComposeGUID'),'['),
     ','
     )
    )

     

  • adedapo Profile Picture
    256 on at

    Ok, so I did some digging on the Microsoft Graph API:
    I can't seem to run a similar query to yours on Power Automate but I can at least run some queries on the /users segment on the Graph Explorer (go figure).

    I'm using the Send an HTTP request (Preview) action as it does not require a premium license. So I don't know if it's the same action you are using.

    adedapo_0-1676549192957.png

    Initialize a string variable for your query. You'll be updating this variable with the next link if any.
    graph_api_issue1.png

     

    In a do until loop, send your request with the query you set earlier, then convert the value array into string. Update the Query variable with the next link (if any)

    body('Send_an_HTTP_request')?['@odata.nextLink']

    Compose the combined output with this expression

    json(replace(variables('Results'),'][',','))

     

  • jim_beam Profile Picture
    25 on at

    Thank you very much!!  I tried the union function and it works amazingly [quick].  I do not fully understand the second option that you provided, but will play with it later.  Thank you again for your help.  Much appreciated

  • jim_beam Profile Picture
    25 on at

    For what its worth - to make the query work, I needed to add Request header "ConsistencyLevel:eventual"

  • ajohnson1 Profile Picture
    22 on at

    Hi! I am struggling with the select value step.

    ajohnson1_0-1699883629285.png

     

    Just to confirm you put the outputs from Parse Json as the "from" field and just item()['value']. (In my case I replaced value with records as that is what is shown in my outputs.

    ajohnson1_1-1699883812245.png

     

  • adedapo Profile Picture
    256 on at

    Your data structure may be different. I'm guessing each item under records is an array?

    {
     "body": {
     "uri": "http...",
     "records": [
     [...],
     [...]
     ]
     }
    }

    If the above structure is correct, then all you have to do is use this expression in a Compose action. No need for Select.

    json(
     replace(
     join(body('Your_action')?['records'],outputs('ComposeGUID')),
     concat(']',outputs('ComposeGUID'),'['),
     ','
     )
    )

     

  • ajohnson1 Profile Picture
    22 on at

    Thank you, what we ended up doing is putting the entire pull into a for each loop and repeating it until there is no more next page. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard