如何使用Logic App中的API管理操作将主体参数传递给API发布操作? [英] How can I pass Body Parameters to API Post operation using API Management Action in Logic App?

查看:44
本文介绍了如何使用Logic App中的API管理操作将主体参数传递给API发布操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个azure函数,当我从postman调用它时效果很好.我正在尝试从逻辑应用程序调用与接收HTTP请求时相同的命令.但是,我无法在APIM中传递原始内容,因为它没有给我相同的选择.它让我仅添加订阅密钥.我的Azure APIM仅接受文件名和订阅密钥.

在这方面的任何帮助都将受到赞赏.

邮递员:(我添加了标题-内容类型,接受:使用)

标题:内容类型 :接受:Ocp-Apim-Subscription-Key

身体:{名称":"olaf"}


Azure Logic应用程序:(使用查看代码);

{输入":{方法":发布",标题":{"Accept":"application/json","Content-Type":"text/csv";}," pathTemplate":{模板":"/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"},"subscriptionKey":" XXXXXXXXXXXXXXXXXXXXXXXX"}}

我需要将正文{}作为azure函数中的参数输入发送

2..在下一页中,点击"请求"标签,然后点击"添加表示形式"添加"application/json".

3..然后单击"新定义".

4..输入请求正文的json示例,它将在"有效负载"中自动生成模式.盒子.

5..单击"保存",然后返回到逻辑应用程序并添加APIM api.您可以找到一个字段"名称"供您选择.

I have an azure function which works well when I call it from postman . I am trying to invoke the same from logic app as when an HTTP request is received. However, I am unable to pass raw content in the APIM as it does not give me an option for the same. It let me add only the subscription key. My Azure APIM accepts file name, subscription key only.

Any help in this regard is much appreciated.

Postman : (I have added Headers - Content-Type, Accept: using )

Headers: Content-Type : Accept: Ocp-Apim-Subscription-Key

Body: { "name": "olaf" }


Azure Logic App: (Using Peek Code);

{ "inputs": { "method": "post", "headers": { "Accept": "application/json", "Content-Type": "text/csv" }, "pathTemplate": { "template": "/scg-liquidTransformer-functionApp/liquidtransformer/{liquidtransformfilename}", "parameters": { "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" }, "subscriptionKey": "XXXXXXXXXXXXXXXXXXXXXXXX" } }

I need to send body {} as a parameter input in the azure functionenter image description here.

Thanks, Paul.

enter image description here

解决方案

You need to do configuration in your APIM, please refer to the steps below:

1. Go to your APIM, find your api and click the "pencil" icon.

2. In next page, click "Request" tab and click "Add representation" to add "application/json".

3. Then click "New definition"

4. Input the json sample of request body, it will generate the schema automatically in "Payload" box.

5. Click "Save", then go back to your logic app and add the APIM api. You can find there is a field "name" for you to choose.

这篇关于如何使用Logic App中的API管理操作将主体参数传递给API发布操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆