简体   繁体   English

天蓝色的逻辑应用程序和http步骤响应

[英]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.然后我们可以从动态内容中选择令牌。

在此处输入图片说明

4.We could check the result. 4.我们可以检查结果。 在此处输入图片说明

There are two ways you can do this. 有两种方法可以执行此操作。

  1. Use expression to directly reference the property. 使用表达式直接引用属性。 @body('NameOfFirstHTTPAction')?['authResult']?'[authToken]

  2. 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.

相关问题 Azure 逻辑应用程序 HTTP 操作步骤 - 动态获取 endOfDate 日期 - Azure Logic App HTTP Action step - dynamically get endOfDate date 为什么 Azure 逻辑应用 HTTP 模块会修改响应负载? - Why is the Azure Logic app HTTP module modifying the response payload? 从 Azure 逻辑应用中的 http 响应中提取文件 - Extract file from http response in Azure logic app 使用Azure Logic App将响应从HTTP保存到Blob存储 - Save the Response from HTTP to Blob Storage using Azure Logic App 如何在 azure 逻辑应用程序中获取 json http 响应的值 - how to get a value of a json http response in azure logic app Azure Logic应用步骤失败,错误为“ BadRequest。 Http请求失败:超时已到” - Azure Logic App Step Fails with error “BadRequest. Http request failed: the timeout was reached” Azure Logic应用HTTP侦听器 - Azure Logic App HTTP Listener Azure 逻辑应用 HTTP 操作步骤 - 动态获取要在查询字符串中使用的日期 - Azure Logic App HTTP Action step - dynamically get dates to use in querystring Azure Logic App,使用 DevOps 部署,第一步“当收到 HTTP 请求时”,如何获取 URL 作为输出变量 - Azure Logic App, deployed using DevOps, first step "When a HTTP request is received", how to get the URL as output variable Azure逻辑应用程序接收图像HTTP触发器 - Azure Logic App Receive Image HTTP Trigger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM