cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CFullerMVP
Regular Visitor

HTTP redirect for 307

I am working with the the http functionality to gather data from a variety of API's to write to Log Analytics. I have one API which requires the ability to handle a 307 redirect (details are below). Currently the Flow errors out at the 307 with a "Temporary Redirect" error. I'm not seeing any options to do http redirect or url forwarding in the http functionality.

 

Handling 307 redirects

When making REST or REST streaming calls, your product will need to handle 307 redirects. Also known as URL forwarding, a 307 Temporary Redirect response provides a new URL for the browser to resubmit a request.

When a 307 redirect happens, you'll need to make the call again with the new URL information. When you do this, you should cache the host and port number for use in future calls with that user/access token. Remember, each call counts toward the rate limit. Consider how your user is interacting with your product. Some users will press a button or choose a setting repeatedly, so if you make a call for every user action, it can impact rate limits very quickly. If a user makes a series of changes in rapid succession, you should only make an API call for the last (most recent) value.

For more information and an example, see How to Handle Redirects.

17 REPLIES 17
OttoVoss
New Member

I'm having the same problem. I'm starting to learn about Flow, and I'm trying to call my API by building a custom connector. In postman, the api call works fine, but when I try to replicate this call in the custom connector, I get a 307 in my server. Were you able to solve it?

 

The server is IIS

MarkStokes
Skilled Sharer
Skilled Sharer

After you make the original HTTP request you can check the Response Code as one of the properties it returns. Does this show you it as a 307? If so, you can query the response body for the redirect url a re-submit the http request, otherwise read the data.

- Mark

Thanks. Did this and worked! 

CFullerMVP
Regular Visitor

I put together a blog post with step-by-step using the Nest API as an example. It won't let me post the URL directly here but it's on the blog site for my employer (CatapultSystems) and is called "how-to-query-the-nest-api-from-logic-apps"

Hi @MarkStokes ,

can you tell me how to check the Reponse Code?

Tried with a switch (true if Return Code = 307, else false). But Power Automate does not even execute this step because HTTP Trigger call failed with Code 307.

Thanks!

The trick on this is to have the step after the original query of the URL execute on fail. In my case it's the JSON parse which occurs after the original check of the URL. I will see if I can update my blog to showcase this with more detail!

In my case I can't execute a step after the original query. Of I don't know which settings to change at the HTTP to have a step exected on "fail". 🤔

The step after the original query is set the Configure Run After option available by the three dots in the top right corner on the step after the original query. Within that I set it to has failed and it's working for me.

"Run After" is not available for me when using HTTP..

 

 

Which trigger are you using for HTTP call @CFullerMVP?

Mine is using the standard HTTP and I'm doing the Configure Run After on the step after the HTTP request which in my case is a parse JSON. The trigger for mine at the start was just a timed request. Can you see the blog post I referenced where I documented this? (It won't let me post the URL here)

Thanks @CFullerMVP - I was actually expecting to set the "Run After" IN the HTTP Step.

Configuring it in the following step totally makes sense now!

Thanks for your amazing help 🙂

I'm glad that I could help on this one, have a great day!

@MarkStokes I came across this old post and can't figure out how to get the redirect url from the HTTP get response.

Please see the step-by-step blog post I posted using Nest as an example. 

mr_frnk
New Member

Is the link to 'How to Handle Redirects' still active? I'm having problems to open it. 

 

CFullerMVP
Regular Visitor

It looks like Nest changed their link to this location: How to Handle Redirects  |  Nest Developers 

digvijay09
New Member

I am getting this error like status code 307 "TemporaryRedirect." and i have also added one more action for HTTP and they send other status code 308. 

If anybody solve it anyway please let me know.

Thanks for help.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,925)