开发 API 连接器 (PowerApps)Develop an API connector (PowerApps)

连接器生成工作由多项步骤组成。Building a connector involves multiple steps. 首先,在 PowerApps 中,单击或点击页面右上角的“设置”按钮(齿轮图标)。To get started - in PowerApps, click or tap the Settings button (the gear icon) at the upper right of the page. 然后,单击或点击“自定义连接器”。Then click or tap Custom Connectors.

查找 API 连接器

描述 APIDescribe your API

使用可定义 HTTP API 接口的 OpenAPI 标准来描述 API 连接器。API connectors are described using the OpenAPI standard for defining the interface of an HTTP API. 可以使用现有的 OpenAPI 文件开始生成,也可以导入 Postman 集合(它会自动为你生成 OpenAPI 文件)。You can start building with an existing OpenAPI file, or you can import a Postman Collection, which auto-generates the OpenAPI file for you.

“定义 API”图

如果开始使用其中任一 API 说明,则会自动填充向导中的元数据字段。If you start from either of these API descriptions, the metadata fields in the wizard are auto-populated. 随时都可以编辑这些字段。You can edit these at any time.

建立安全机制Build security

选择服务支持的身份验证类型,并提供其他详细信息,以便可以在服务和任意客户端之间适当传播标识。Pick the authentication type supported by your service, and provide additional details to enable identity to flow appropriately between your service and any clients.

“建立安全机制”图

详细了解连接器安全性。Learn more about connector security.

生成触发器和操作Build triggers and actions

  1. 若要为连接器生成触发器和操作,请切换到“定义”选项卡。To build the triggers and actions for your connector, switch to the Definition tab.

    “定义”图

  2. 使用向导,可以添加新操作,也可以编辑现有操作的架构和响应。Using the wizard, you can add new operations or edit the schema and response for existing ones. 通过各个操作的“常规”属性,可以控制连接器的最终用户体验。The General properties for each operation enable you to control the end-user experience for your connector. 请单击下面的链接,详细了解不同类型的操作:Learn more about the different types of operations using the links below:

  3. 最后,单击或点击“创建连接器”,注册 API 连接器。Finally, click or tap Create connector to register the API connector.

若要使用向导中没有的其他功能,请联系 condevhelp@microsoft.comFor additional features not available in the wizard, please contact condevhelp@microsoft.com.

测试连接器Test the connector

提交前,请使用一种或多种方法测试 API 连接器:Prior to submission, test your API connector in one or more ways:

  • 使用 API 连接器“测试”向导,可以调用各个操作来验证其功能和响应架构。Using the API connector Testing wizard, you can call each operation to verify its functionality and the response schema.
  • 在 Microsoft Flow 设计器中,可以使用 API 连接器以直观的方式生成流。In the designer for Microsoft Flow, you can visually build flows using your API connector. 通过这种测试方法,可以了解连接器的用户界面功能。This method of testing gives you visibility into the user interface functionality and features of your connector.
  • 在 PowerApps Studio 中,可以使用编辑栏调用各个操作,然后将响应绑定到屏幕上的控件。In the PowerApps Studio, you can call each operation using the formula bar, and bind the response to controls on your screen.

本主题提供了概述性信息;有关详细信息,请参阅注册和使用自定义连接器This topic provides an overview; for more information, see Register and use a custom connector.