Search code examples
power-automatepower-automate-custom-connector

Power Automate issue handling 302 redirect response - Get status call after redirection


Good afternoon Community!,

I am building a flow on Power Automate that is making a HTTP request to an external API to POST a CSV File.

In the first attempt, the flow was failing with a 302 redirect response which I fixed adding a condition / Configure run after / has failed. It all seems to be "working fine" however, I can't see the status response after the re-direction which I need in order to know that the submission was successful and therefore, do the following action.

I tried to Initializes a variable and grab the response but I still can't see the details of the response after redirection, is there any way how I can get the final status code?

Many thanks in advance for your help.

(Please see screenshot for reference)

enter image description here


Solution

  • I would suggest to configure the run after on the condition action. This way you can always retrieve the status code value and check it in the condition.

    outputs('HTTP')['statusCode']
    

    In the If Yes you can place another HTTP action which can use the value the Location property (which is located in the Headers of the 302 response).

    outputs('HTTP')['headers']['Location']
    

    I have a blog about this approach (it is about 301, but the approach for 302 would be the same). https://www.expiscornovus.com/2021/01/08/how-to-workaround-a-http-301/