英文:
Power Automate issue handling 302 redirect response - Get status call after redirection
问题
下午好社区!我正在构建一个在Power Automate上的流程,该流程会向外部API发出HTTP请求以POST一个CSV文件。
在第一次尝试时,流程失败,返回了一个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)
答案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/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论