Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

First HTTP call (REST) returns a response in JSON format -

{

   "authResult": {

      "isPasswordExpired": true,

      "authToken": "cxxcxcxc",

      "message": "Login Successful"
   }
}

I want to send authtoken from the result in second http action as authorization header.

like image 595
msreekm Avatar asked Oct 20 '25 05:10

msreekm


2 Answers

As Derke Li mentioned that we could use exression or Parse Json to do that. I also do a demo about how to use the Parse JSON action.

1.Add the Parse Json action after the first Http action

enter image description here

2.Add the parse content and click on the button "Use sample payload to generate schema" and that will pop a new window. Paste in your "authResult" json. As seen in the below image.

enter image description here

3.Then we could pick the token from the dynamic content.

enter image description here

4.We could check the result. enter image description here

like image 195
Tom Sun - MSFT Avatar answered Oct 21 '25 23:10

Tom Sun - MSFT


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. Then, in the second HTTP action, you will see authToken as a token from the dynamic content picker for you to reference.

like image 42
Derek Li Avatar answered Oct 21 '25 23:10

Derek Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!