Reputation: 1326
I have an Azure Logic App with a queue trigger. The queue message is JSON. When I send "Message text" to an Azure function, I get
UnsupportedMediaType
{
"Message": "The WebHook request must contain an entity body formatted as JSON."
}
I'd assumed this would work directly.I tried setting request body to
@{json(<Message text>)}
where is the select dynamic content item, but I get red message "Enter a valid json".
What's the trick to making this connection? Do I have to pass in and then parse out "Message text" in my function? Again, I assumed it would do that automagically.
Upvotes: 0
Views: 1107
Reputation: 27852
For future readers.
I was passing some (what seems to be to be valid) json to my webhook.
And kept getting the
"Message": "The WebHook request must contain an entity body formatted as JSON."
error.
:(
Finally, I found a json "expression" that did its voodoo and got rid of the error. I argument from the json-expression was my previous action's output, which was valid json. It apparently needs just a little help!
The raw (non designer) code was:
"GenericWebHookCsharpOne": {
"type": "Function",
"inputs": {
"body": "@json( body('MyPreviousAppLogicActionWhichIsAnAzureFunction'))",
"method": "POST",
"function": {
"id": "/xxxxxxxxxxxxxxxxxxxxxxxx
}
Upvotes: 0
Reputation: 1466
The @{}
syntax indicates string interpolation. This means that your expression @{json(<Message text>)}
de-serializes the message text to json, and then serializes it again.
Hence the expression that you want to use is
@json(<Message text>)
Upvotes: 1