cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dänu
Frequent Visitor

HTTP redirect error 302

Hey everyone

 

I'm currently trying to implement a process which will use an API to search for users in a database. Now I've created a flow with the "HTTP" component and set it up. But whatever I try, it will always result with the error 302 with the details: <html><body>You are being <a href="https://ADDRESS/">redirected</a>.</body></html>

 

I tried to use the given location in the header for a second HTTP command but this didn't work either. 

 

The API is working as it should as I can call it with Postman.

 

Does anyone know how to fix this? 

 

I appreciate any kind of help and with best regards,
Dan

1 ACCEPTED SOLUTION

Accepted Solutions
Dänu
Frequent Visitor

So, I was able to fix the issue by adding "Accept" to the headers. 

 

Dänu_0-1597925216528.png

 

Thanks for the help nonetheless @manuelstgomes 

View solution in original post

6 REPLIES 6
manuelstgomes
Community Champion
Community Champion

hi @Dänu 

 

Postman deals well with URLs that redirect to the actual API. In this case Power Automate is catching the HTML of the redirect page. You should use the URL that is being redirected to to avoid this.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Hey @manuelstgomes 

 

Do you mean the URL which is defined as "Location" in the headers list?

 

Cheers,
Dan

manuelstgomes
Community Champion
Community Champion

HI @Dänu 

 

Yes. For example, you're calling an API www.api.com but that URL redirects to www.realapi.com

Some redirects have a page indicating "You're being redirected" and that looks like what you're getting as the response for your HTTP post.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Hey @manuelstgomes 

Unfortunately I've already tried that and it didn't work.

Dänu
Frequent Visitor

Hey

 

I think I found the issue...

It seems like Microsoft flow is pushing "text/html" instead of "application/json" as I've defined:

from the system logs of the server: [...] microsoft-flow/1.0" "text/html; charset=utf-8"

 

{
"inputs": {
"method": "GET",
"uri": "https://SITE/",
"headers": {
"Content-Type": "application/json"
},
"authentication": {
"type": "Basic",
"username": "@variables('API Key')",
"password": "x"
}
}
}

 

Does anyone know how to fix that?

Dänu
Frequent Visitor

So, I was able to fix the issue by adding "Accept" to the headers. 

 

Dänu_0-1597925216528.png

 

Thanks for the help nonetheless @manuelstgomes 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,442)