[英]azure logic app & http step response
I have 2 HTTP actions, one after another in a logic app, how do I read the response from a previous HTTP action in the second HTTP action? 我有2个HTTP动作,一个逻辑应用程序中一个接一个,我该如何在第二个HTTP动作中读取上一个HTTP动作的响应?
First HTTP call (REST) returns a response in JSON format - 首次HTTP调用(REST)以JSON格式返回响应-
{
"authResult": {
"isPasswordExpired": true,
"authToken": "cxxcxcxc",
"message": "Login Successful"
}
}
I want to send authtoken
from the result in second http action as authorization header. 我想从第二个http动作的结果中发送
authtoken
作为授权标头。
As Derke Li mentioned that we could use exression or Parse Json to do that. 正如Derke Li提到的那样,我们可以使用exression或Parse Json来实现。 I also do a demo about how to use the Parse JSON action.
我还演示了如何使用JSON解析操作。
1.Add the Parse Json action after the first Http action 1.在第一个Http操作之后添加Parse Json操作
2.Add the parse content and click on the button "Use sample payload to generate schema" and that will pop a new window. 2.添加解析内容,然后单击“使用示例有效负载生成模式”按钮,这将弹出一个新窗口。 Paste in your "authResult" json.
粘贴到您的“ authResult” json中。 As seen in the below image.
如下图所示。
3.Then we could pick the token from the dynamic content. 3.然后我们可以从动态内容中选择令牌。
There are two ways you can do this. 有两种方法可以执行此操作。
Use expression to directly reference the property. 使用表达式直接引用属性。
@body('NameOfFirstHTTPAction')?['authResult']?'[authToken]
Add a "Parse JSON" action in between the two HTTP action, and provide a sample response of the first HTTP action to generate a schema. 在两个HTTP操作之间添加“解析JSON”操作,并提供第一个HTTP操作的示例响应以生成模式。 Then, in the second HTTP action, you will see
authToken
as a token from the dynamic content picker for you to reference. 然后,在第二个HTTP操作中,您将看到
authToken
作为来自动态内容选择器的令牌,以供您参考。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.