如何正确设置PowerApp的Swagger? [英] How to setup Swagger for PowerApps correctly?

查看:166
本文介绍了如何正确设置PowerApp的Swagger?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我要连接到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"
            }
          }
        }
      }
    }
  }
}

我从来没有用过招摇过头,但我已经找到了我,最好是使用base64字符串.

Ive never worked with swagger but ive already found out, the best is to work with base64 string.

推荐答案

Microsoft提供了有关导入到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.

这篇关于如何正确设置PowerApp的Swagger?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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