How to setup Swagger for PowerApps correctly?(如何正确设置 Swagger for PowerApps?)
问题描述
这是我想要连接到我的 PowerApps 的 Azure 函数
This is my Azure function I want to connect to my PowerApps
[FunctionName("ConvertMe")]
public static IActionResult RunAsync
([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log)
{
log.LogInformation($"Received a Request");
ConvertMe Converter = new ConvertMe();
string test1 = req.Query["image1"];
string test2 = req.Query["image2"];
MagickImage _Main = new MagickImage(Convert.FromBase64String(test1), MagickFormat.Png);
MagickImage _Overlay = new MagickImage(Convert.FromBase64String(test2), MagickFormat.Png);
using (MemoryStream memory = new MemoryStream())
{
Converter.ComebineBitmap(_Main, _Overlay).Write(memory, MagickFormat.Png);
memory.Position = 0;
return new FileContentResult(memory.ToArray(),"image/png");
}
}
它已经在本地运行,但我想在 PowerApps 中使用它.如何获得 Swagger 的返回值?
Its already working on local but I want to use it in PowerApps. How do I get my return value to Swagger ?
我目前的招摇文件
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "MyAzureFunction"
},
"host": "xxx",
"paths": {
"/api/ConvertMe": {
"get": {
"description": "Calls my azure function over https",
"operationId": "ConvertMe",
"parameters": [
{
"name": "code",
"in": "query",
"description": "code",
"default": "code",
"type": "string"
},
{
"name": "image1",
"in": "query",
"required": true,
"type": "string"
},
{
"name": "image2",
"in": "query",
"required": true,
"type": "string"
},
],
"responses": {
"200": {
"description": "Successful response",
"schema": {
"title": "The response of the api.",
"type": "string"
}
}
}
}
}
}
}
我从未使用过 swagger,但我已经发现,最好是使用 base64 字符串.
Ive never worked with swagger but ive already found out, the best is to work with base64 string.
推荐答案
微软有一个 从无服务器 API 创建 OpenAPI 定义.如果您按照列出的步骤进行操作,您最终将获得下载 OpenAPI 定义步骤,您可以使用它来导入到 powerapps 以制作您的自定义连接器.
Microsoft has a tutorial for creating an OpenAPI definition from a server-less API. If you follow the steps laid out you will eventually get to the Download the OpenAPI definition step, which is what you can use to import into powerapps to make your custom connector.
这篇关于如何正确设置 Swagger for PowerApps?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何正确设置 Swagger for PowerApps?


基础教程推荐
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 将数据集转换为列表 2022-01-01
- 如果条件可以为空 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01