处理 Power Automate 302 重定向响应 – 在重定向后获取状态调用

huangapple go评论63阅读模式
英文:

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

问题

下午好社区!我正在构建一个在Power Automate上的流程,该流程会向外部API发出HTTP请求以POST一个CSV文件。

在第一次尝试时,流程失败,返回了一个302重定向响应,我通过添加条件/配置运行后/失败后进行了修复。一切似乎都是“正常工作”的,然而,我无法看到重定向后的状态响应,我需要知道提交是否成功,以便执行以下操作。

我尝试初始化一个变量并获取响应,但我仍然无法在重定向后看到响应的详细信息,是否有办法获取最终的状态代码?

非常感谢您的帮助。

(请参考下面的截图)

处理 Power Automate 302 重定向响应 – 在重定向后获取状态调用

英文:

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)

处理 Power Automate 302 重定向响应 – 在重定向后获取状态调用

答案1

得分: 0

我建议在条件操作中配置运行之后。这样,您始终可以检索状态码值并在条件中进行检查。

outputs('HTTP')['statusCode']

如果是肯定的情况,您可以放置另一个HTTP操作,该操作可以使用302响应的标头中的Location属性的值。

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

我有一篇关于这种方法的博客(虽然是关于301,但对于302来说,方法是一样的)。
https://www.expiscornovus.com/2021/01/08/how-to-workaround-a-http-301/

英文:

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/

huangapple
  • 本文由 发表于 2023年4月6日 20:43:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75949669.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定