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 Apps / Power Apps/Power Autom...
Power Apps
Answered

Power Apps/Power Automate API Call Issue

(1) ShareShare
ReportReport
Posted on by 11
I have a Power Apps screen with a button that runs a Flow I created in Power Automate to call a web service endpoint. And this works well, except when it doesn't. The Flow accepts input collected from the Power Apps screen and feeds it as a parameter to the Flow. If the user supplies an invalid value (which would not be known to Power Apps) and the API call fails, all I see in Power Apps is a 502 error. But if I use the "Test" option when working on the flow outside of Power Apps and feed the same "bad" parameter values, I get the actual error messages returned by the API which tell me what it didn't like. 
 
How do I get this error response passed back to the Power App screen so I can tell the user what they did wrong?
 
Example of what the Power App sees:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Example of what is returned when using the Test option (with the exact same parameter values):
 
Categories:
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,569 Super User 2025 Season 2 on at
    Hi,
     
    Super easy, but it would be lots easier if you had shared your flow since you asked how to pass data back but didnt share so here is the answer
     
    1. In your flow you need to add a Try / Catch Scope set, so that you can catch the error
    2. Add a Variable to capture Status and StatusCode, default Status as a String to "Successful", Set StatusCode as an Integer and set it to 200. This way they are defaulted to it worked
     
    3. In your Catch Scope action, set the StatusCode to "502" or 500 doesn't really matter unless you want the EXACT code from the API in which case you need to grab that from the HTTP Call Response to the API and then Set the StatusCode variable to whatever you pull out.
     
    Set the Status to either "Failed" or whatever message you get back from the API call
     
    4. Add a Respond to Power Apps Action at the end of your flow. Make sure you set the Catch RunAfter Settings to only Timed Out, Failed/Error, Skipped and set the RunAfter for the Response to Power Apps / Child Flow Action to all 4, Success, Failed/Error, skipped, Timed Out
     
    Pass back the Status and StatusCode values
     
    In your Canvas app when you call your flow do it like this
     
    Set(responseStatus, MyFlow.Run());
     
    Now you call check responseStatus.Status to see the words or responseStatus.StatusCode to get the number and see if it failed or not.
     
  • JC-07021927-0 Profile Picture
    11 on at
    Thanks for the response. I will post the entire Flow next time. This gives me enough to go on. Much appreciated.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 559 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 315 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 250

Last 30 days Overall leaderboard