Forum Discussion
Handling 307–Temporary Redirect Errors With Web.Contents() In Power Query
Hi DarinSpence
That's odd. The MSOFT doco indicates that you can interept 3xx errors and handle them
Handling status codes with Web.Contents for Power Query connectors - Power Query | Microsoft Docs
But as you've found, you get an error with a 307. In my testing I get an error with any of the 3xx status codes. based on the doco, that's not what I expect. Perhaps it is a bug? You could report it.
I've tried in Excel and PBI and had the same errors.
Sorry, can't help any further at this point.
regards
Phil
PhilipTreacy , thanks for testing the 307. I'll report it. I suspect that there's come clever way to 'make it work,' but I'm struggling to find it.
- DarinSpence3 years agoHelper II
Microsoft looked into this and said: By default, Web.Contents should follow up to 50 redirects before giving up and returning an error. Looking at the Fiddler traces, this seems to be what’s happening. However, it also seems like the site expects the “Set-Cookie” directives in the response to get passed on to the next request and they also told that kind of cookie-handling is only standard in browsers. (This could explain why the site works with Web.BrowserContents.)
- So, from product team response we can understand that only Web.BrowserContents works in this scenario.
- daviddusa3 years agoRegular Visitor
Thank you for going after the issue!
Unfortunately, Web.BrowserContents is not applicable for in case, because headers cannot be provided for the method. I am trying to solve basic authentication using the Authorization header.
The only workaround I see currently is to modify our REST API slightly.
- DarinSpence3 years agoHelper II
Sadly, I cannot modify the API. I'd rather use Web.Contents, but it doesn't look like that will be supported.