本文介绍了使用Azure Logic应用程序从API提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从第三方API中提取数据,并对数据进行较小的处理,然后将其发送到DB.是否有用于使用Logic App提取API数据的连接器?任何连接器或动作?如何开始.

I need to Pull data from a 3rd party API and minor process that data and then send it to DB. Is there any connector to pull API data using Logic App? Any connector or Action? How to start.

推荐答案

似乎您想使用逻辑应用程序对任何API提取数据?

It seems you wants to fetch data from any API using logic App right?

是的,您可以使用azure portal上的Logic Apps Custom Connector进行操作,请参见以下屏幕截图:

Yes you can do it using Logic Apps Custom Connector on azure portal see the screen shot below:

如何使用自定义连接器连接任何API:

第1步:创建新的自定义连接器

要创建Custom Connector,请转至Azure门户,然后在All services中搜索Logic Apps Custom Connector,然后单击它并添加新连接器.看到屏幕截图:

To create a Custom Connector go to azure portal and in All services search for Logic Apps Custom Connector click on it and Add New Connector. see the screen shot:

第2步:编辑自定义连接器

一旦创建了新的自定义连接器,然后要添加API,则必须Edit对其进行配置,以使用new custom connector

Once you have created new custom connector then to add your API with it you have to Edit it to configure your API request and response with the new custom connector

第3步:配置自定义连接器

自定义连接器分为3部分

There are 3 part of custom Connector

1.常规

在这里您会看到Host输入API主域名,例如dotnetavalanche.azurewebsites.net

Here you would see Host enter your API main domain name like dotnetavalanche.azurewebsites.net

将基本网址保留为空

2.安全性

对于测试建议,无需身份验证,只需将其保留为空

For test propose no authentication required just leave it blank

3.定义

输入Summary音符,description,但一定要输入Operation ID,该字符应与TestAPI

enter a Summary note , description but surely enter a Operation ID which should unique like TestAPI

请求

然后在Request选择中单击Import from sample并输入您的API方法类型,例如POSTGET

Then in Request selection click on Import from sample and enter your API method type Like POST or GET

您的APIUR L全部,例如:https://dotnetavalanche.azurewebsites.net/api/PartnerBotRequest

Full URL of your API for example: https://dotnetavalanche.azurewebsites.net/api/PartnerBotRequest

查看屏幕截图:

回复:

在此处单击Add default response并添加来自API的预期响应Json

Here click on Add default response and add Json of your expected response from API

在Azure Logic应用上调用自定义连接器

转到azure logic App并单击Request Body JSON Schema上的Http Request,将其粘贴到JSON

Go to azure logic App and click on Http Request on Request Body JSON Schema paste below JSON

{
    "type": "object",
    "properties": {
        "title": {
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "email": {
            "type": "string"
        }
    }
}

然后单击Next Step并添加您的自定义连接器,如下所示:

Then click on Next Step and add your custom connector like below:

然后最后将new Step添加为Response

配置如下屏幕截图所示的响应:

Configure the response as below screen shot:

如果您还有任何疑问,请随时分享.谢谢,祝您编程愉快!

If you still have any query feel free to share. Thanks and happy coding!

这篇关于使用Azure Logic应用程序从API提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:38