如何通过REST调用(如Postman)创建Power Automate自定义连接器?
Power Automate 通过REST API创建自定义连接器的支持说明
是的,Power Automate 完全支持通过REST API创建自定义连接器,无需依赖UI操作,对应的接口属于Microsoft Power Platform API体系。
核心信息
1. 认证要求
调用前需获取Azure AD访问令牌,需具备Microsoft.PowerPlatform/connectors/write权限(可通过Azure AD应用注册配置)。请求头需包含:
Authorization: Bearer <你的Azure AD访问令牌> Content-Type: application/json
2. 创建自定义连接器的API端点
POST请求URL:
https://api.powerplatform.com/providers/Microsoft.PowerPlatform/apis/apis?api-version=2020-06-01
3. 请求JSON负载示例
{ "properties": { "displayName": "自定义示例连接器", "description": "通过REST API创建的连接器", "apiType": "Rest", "swaggerDefinition": { "swagger": "2.0", "info": { "title": "SampleCustomConnector", "version": "1.0.0" }, "host": "api.yourdomain.com", "basePath": "/api/v1", "schemes": ["https"], "paths": { "/user/profile": { "get": { "parameters": [ { "name": "userId", "in": "query", "required": true, "type": "string" } ], "responses": { "200": { "description": "成功获取用户信息", "schema": { "type": "object", "properties": { "id": {"type": "string"}, "name": {"type": "string"} } } } } } } } }, "connectionParameters": { "apiKey": { "type": "securestring", "uiDefinition": { "displayName": "API密钥", "description": "访问目标API的授权密钥", "constraints": { "required": true } } } } }, "location": "eastus" }
关键字段说明
location: 替换为你的Power Automate环境所在区域(如westus、northeurope)swaggerDefinition: 可根据实际API需求调整,支持Swagger 2.0或OpenAPI 3.0规范connectionParameters: 定义连接器的认证方式(如API密钥、OAuth等)
4. 更新自定义连接器
若需更新已存在的连接器,使用PUT请求,URL格式为:
https://api.powerplatform.com/providers/Microsoft.PowerPlatform/apis/apis/{connectorName}?api-version=2020-06-01
负载结构与创建请求一致,修改对应字段即可。
内容的提问来源于stack exchange,提问作者Steven Augustine Stuart
相关产品推荐
相关产品推荐

