Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate

Now, there are several questions about how can we make HTTP requests from a Canvas Power App. Well, as of today, only HTTP with Azure AD exists in native Canvas Power App Connectors, so in order to call HTTP requests only to external resources, you’ll need to go via a Flow and get response back.

Scenario

Call a Flow from within a Canvas Power App and capture the response back in the Canvas Power App.

In my example to keep things easy, I’m using a sample HTTP request provided by https://openweathermap.org/ (OpenWeatherMap) [I know there are native Weather connectors, but I’m just using as an example]

Flow

Here’s how Flow looks –

  1. Let’s say I create an Automated Flow which is triggered from a Power App. Just select that, there’s nothing to add to it.


  2. Next Step, I’ll make an HTTP request to a Service (In my example, I want to retrieve Humidity. You would of course have your use case)
    I’ve used the same example in one of my posts where I talked about making HTTP requests using Flow. Check this post – Make HTTP request from Flow in Power Automate


  3. To breakdown my received HTTP response into distinct pieces of info, I’ll parse it.

  4. Final step would be to send back the parsed info to the Power App itself so that I can use the info internally in the Canvas Power App from which this Flow was called.

  5. Now, I’m choosing to send back the Humidity value. So, I’ll choose a type of Output to be sent my response into

  6. And since I already parsed the response in the step above, it’s easy to select what piece of info I want to send back to my Canvas Power App.
    I’ve created a variable called as humidityValue and in that I’m passing humidity from the parsed JSON step.

  7. That’s it. My Flow overall looks like this

Canvas Power App

In my Canvas Power App, I only have a button which will populate the data into a label –

  1. Let’s say, I have a button called as Get Humidity. And below it, is a Label having “Humidity is” already written

  2. Now, the next step is to add the Flow in the Canvas Power App. Navigate to Action in the menu bar in Canvas Power App Studio and look for Power Automate

  3. On clicking it, you’ll be able to select the Flow you want to add in the Canvas Power App

  4. Once you select that, it’ll appear on the OnSelect formula bar of the button. Ideally, this should be added to whatever event you want the Flow to Run from (In my case, click of Get Humidity button)
    It’ll populate with a default formula like below. But we need some modification for it to be populated to the Label.

  5. Now, you can write the below formula to add the value retrieved from the variable which you created dynamically called as ‘humidity‘ and upon adding dot to the Run(), you’ll be able to select the variable you passed to the Canvas App from Flow.

  6. So, the completed Formula looks like this.
    Here, I’m using Set() function to set a dynamically declared variable in called as humidity and populate it with the value of humidityValue which we’ll get when we run Flow and the Flow will make an HTTP call to get that value.
    In case you also need to understand how variables work, you can refer this post of mine – Variables in Canvas Power Apps | Global and Context

  7. Now, we need to set it to the Label. So, we’ll write a formula on the Label’s Text event. So that, the Label is displaying Humidity is <valueOfHumidity> variable

  8. And you’re set. Hope this explanation was easy. Now, let’s Run the App and click Get Humidity button

Working

When I click a button, I’ll get the value into the Label field which I created.

When I click the button, it’ll be greyed out for a moment while the Canvas Power App calls the Flow and the Flow runs the HTTP request and sends back response to Canvas Power App.

Finally, once the variable is set, the Label control will display the value as below which came via HTTP using Flow

You can also see the results going in the Flow Run as well

Hope this was useful. Here are some more Canvas Power App & Power Automate posts you might want to look at –

  1. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  2. Accept HTTP Requests in a Flow and send Response back | Power Automate
  3. Launch URL on a Data Table Text column selection in a Canvas PowerApp | SharePoint Lists
  4. Terminate a Flow with Failed/Cancelled status | Power Automate
  5. Aggregate functions in a Canvas Power App | Using on SharePoint Lists
  6. Logged In User details in a Canvas Power App
  7. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  8. Implement character length validation in a Canvas Power App | Power Platform
  9. Call a Dynamics 365 Action from Flow [Bound and Unbound Actions] | Power Automate
  10. Pause a Flow using Delay and Delay Until | Power Automate
  11. BPF Flow Step as a Trigger in CDS (Current Environment) connector | Power Automate
  12. Generate Dynamics 365 record link in a Flow using CDS connector | Power Automate
  13. Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform
  14. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App
  15. Using Parse JSON to read individual List Records in Flow|Power Automate

Thank you!

2 thoughts on “Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate

  1. Hello, I found your post very interessant. Anyway, I can’t get out of a problem. can you help me?
    I would like to write (create) an event to a specific User Calendar from PowerApps or Flow. To do it i first created a custom connector by calling the API Graph POST /users/{id | userPrincipalName}/calendars/{id}/events, but when i call the method in the canvas, the attendees parameter doesn’t work; Where i am wrong?

    Like

    • Hi Andi, Thanks! I’m glad my post was helpful to you. This looks like an extensive scenario which I need to test myself since I haven’t yet. I’ll try to review your know and let you know if I am able to come up with an answer. Till then, I suppose the best answers would come from the PowerApps community forum.

      Hope this helps!!

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.