简体   繁体   English

逻辑应用程序 - 对 API 的 HTTP 连接器 POST 调用返回 202 和位置标头,但轮询返回 404

[英]Logic apps - HTTP connector POST call to API returns 202 and location header but the polling returns 404

We have implemented a Logic app to call do a POST call to a third-party API which returns a 202 with location header.我们已经实现了一个逻辑应用程序来调用对第三方 API 的 POST 调用,该 API 返回带有位置标头的 202。 The Logic app in the backend automatically polls using the location header resulting in GET request to the third-party provider hoping to receive a 200 response once the processing is complete.后端中的逻辑应用程序使用位置标头自动轮询,从而向第三方提供程序发出 GET 请求,希望在处理完成后收到 200 响应。 However, the GET requests are resulting in 404 errors.但是,GET 请求会导致 404 错误。

We have tried disabling the check location headers but for some reason Logic apps still continues to send the GET requests and at a faster rate.我们已尝试禁用检查位置标头,但出于某种原因,逻辑应用程序仍会继续以更快的速度发送 GET 请求。

在此处输入图片说明

Is there any way to stop the GET request from Logic Apps or should this be the third-party provider's responsibility to handle the polling and not send 404's?有什么方法可以阻止来自逻辑应用程序的 GET 请求,或者这应该是第三方提供商处理轮询而不发送 404 的责任吗?

Yes, you can stop the GET request from your Logic Apps.是的,您可以停止来自逻辑应用的 GET 请求。 Basically it totally depends on your workflow.基本上这完全取决于您的工作流程。 If you are designing a stateful workflow then I would suggest that not to stop the GET request.如果您正在设计有状态工作流,那么我建议不要停止 GET 请求。

For stateful workflow all HTTP-based actions follow the standard asynchronous operation pattern as the default behavior.对于有状态工作流,所有基于 HTTP 的操作都遵循标准异步操作模式作为默认行为。 Where after an HTTP action calls or sends a request to an endpoint or API, the receiver immediately returns a "202 ACCEPTED" response.在 HTTP 操作调用或向端点或 API 发送请求后,接收方立即返回“202 ACCEPTED”响应。 And the response can include a location header which the caller can use to poll or check the status for the asynchronous request until the receiver stops processing and returns a " 200 OK " success response or other non-202 response.并且响应可以包含一个location标头,调用者可以使用它来轮询或检查异步请求的状态,直到接收器停止处理并返回“ 200 OK ”成功响应或其他非 202 响应。

But if you are designing a stateless workflow , then caller doesn't have to wait for the request to finish processing and can continue to run the next action.但是如果你正在设计一个无状态的工作流,那么调用者就不必等待请求完成处理并且可以继续运行下一个动作。 In this case the receiver return the "202 ACCEPTED" response as-is, and proceed to the next step in the workflow execution.在这种情况下,接收方按原样返回“202 ACCEPTED”响应,并继续执行工作流的下一步。 A stateless workflow won't poll the specified URI to check the status .无状态工作流不会轮询指定的 URI 来检查 status

You can stop the GET request from your logic app by following any of the two approaches mentioned below.您可以按照下面提到的两种方法中的任何一种停止来自逻辑应用的 GET 请求。

  1. Turn off Asynchronous Pattern setting.关闭异步模式设置。

    You can achieve this by going to the Logic App Designer, on the HTTP action's title bar, selecting the ellipses ( ... ) button and setting Asynchronous Pattern to Off if enabled.您可以通过转到逻辑应用程序设计器,在 HTTP 操作的标题栏上,选择省略号 ( ... ) 按钮并将异步模式设置为关闭(如果启用)来实现此目的。

禁用异步操作

  1. Disable asynchronous pattern in HTTP action's JSON definition .HTTP 操作的 JSON 定义中禁用异步模式。

    In the HTTP action's underlying JSON definition, add the "DisableAsyncPattern" operation option to the action's definition so that the action follows the synchronous operation pattern.在 HTTP 操作的底层 JSON 定义中,将"DisableAsyncPattern"操作选项添加到操作的定义中,以便操作遵循同步操作模式。 Check this document for more information.查看此文档以获取更多信息。

Also check this Asynchronous request-response behavior document by Microsoft for more understanding.另请查看 Microsoft 的此异步请求-响应行为文档以获取更多理解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM