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
Super User
Super User

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

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 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,643)