如何使用逻辑应用程序中的 API 管理操作将 Body 参数传递给 API Post 操作?

How can I pass Body Parameters to API Post operation using API Management Action in Logic App?

我有一个 azure 函数,当我从 postman 调用它时它运行良好。我正在尝试从逻辑应用程序调用与收到 HTTP 请求时相同的内容。但是,我无法在 APIM 中传递原始内容,因为它没有为我提供相同的选项。它让我只添加订阅密钥。 我的 Azure APIM 只接受文件名、订阅密钥。

非常感谢这方面的任何帮助。

邮递员:(我已添加 Headers - Content-Type,接受:正在使用)

Headers: Content-Type : 接受: Ocp-Apim-Subscription-Key

Body: { “名字”:“奥拉夫” }


Azure 逻辑应用程序:(使用 Peek 代码);

{ “输入”:{ “方法”:“post”, “headers”:{ "接受": "application/json", “Content-Type”:“text/csv” }, “路径模板”:{ “模板”:“/scg-liquidTransformer-functionApp/liquidtransformer/{liquidtransformfilename}”, “参数”: { “liquidtransformfilename”:“@{encodeURIComponent('xmlsample.liquid')}” } }, “api”:{ "id": "/subscriptions/XXXXXXXXXXXXXXXXXXXXX/resourceGroups/scg-mel-dev-arg-liquidtransformer/providers/Microsoft.ApiManagement/service/scg-liquidTransformer-functionApp-apimservice/apis/scg-liquidtransformer-functionapp" }, “订阅密钥”:“XXXXXXXXXXXXXXXXXXXXXXXX” } }

我需要发送 body {} 作为 azure 函数的参数输入enter image description here。

谢谢, 保罗.

enter image description here

您需要在APIM中进行配置,请参考以下步骤:

1. 转到您的 APIM,找到您的 api 并单击“铅笔”图标。

2. 在下一页中,单击“请求”选项卡并单击“添加表示”添加“application/json”。

3.然后点击“新建定义

4. 输入请求体的json样本,会在“Payload”框中自动生成schema .

5. 单击“保存”,然后返回到您的逻辑应用并添加 APIM api。您会发现有一个字段“name”供您选择。