I have a HTTP listener that I am sending a JSON post body with.
{
"recipient":"bob@example.com",
"subject":"this is a test subject",
"body":"this is a test body email"
}
I am trying to pull those individual parameters out in the next flow, but it errors instead!
The result I am looking to achieve is "bob@example.com" being taken as an input for the next action
I've tried things like
"@{triggers().outputs.body.Content.recipient}"
and various variations of, but I suspect I'm missing something!
edit to add
I am currently sending the post request via Powershell, though it will ultimately be over c#
$a = @"
{"recipient":"bob@example.com","subject":"this is a test subject","body":"this is a test body email"}
"@
Invoke-WebRequest -Uri https://httplistenerc743421edf234899a1315aa38c6398bc.azurewebsites.net/listen -Method POST -Body $a
Ah the trick with this is the output of the HTTP Listener body is a String, so you need to convert it to JSON before you can parse it. There is a @parse() command to do just this.
So if you do this it should work:
@{json(trigger().outputs.body.Content).recipient}
That should give you the recipient. Let me know if that doesn't work.
你必须在http监听器的头部定义内容类型,之后你不需要解析http监听器的响应,它将自动以描述的格式。
as i did with mine where azure function is returning json data as text/string:
@{body('azure_fun_Name').recipient}
@{body('azure_fun_Name').subject}
@{body('azure_fun_Name').body}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.