Logic App中的Swagger API连接器(通过Azure API管理)中缺少订阅密钥字段

时间:2018-02-14 15:27:46

标签: azure swagger azure-logic-apps azure-api-management openapi

我创建了一个带有Swagger / OPEN API规范的REST API,我希望通过逻辑应用程序中的Azure API管理租户使用该规范。

当我下载规范时,它看起来像这样:

{
  "swagger": "2.0",
  "info": {
    "title": "Leasing",
    "version": "1.0"
  },
  "host": "ENDPOINT.azure-api.net",
  "basePath": "/leasing",
  "schemes": [
    "http",
    "https"
  ],
  "securityDefinitions": {
    "apiKeyHeader": {
      "type": "apiKey",
      "name": "Ocp-Apim-Subscription-Key",
      "in": "header"
    },
    "apiKeyQuery": {
      "type": "apiKey",
      "name": "subscription-key",
      "in": "query"
    }
  },
  "security": [
    {
      "apiKeyHeader": []
    },
    {
      "apiKeyQuery": []
    }
  ],
  "paths": {
    "/{Brand}/groups": {
      "get": {
        "description": "Get a list of leasing groups on a brand",
        "operationId": "GetGroups",
        "parameters": [
          {
            "name": "Brand",
            "in": "path",
            "description": "Selection of possible brands",
            "required": true,
            "type": "string",
            "enum": [
              "Volkswagen",
              "Audi",
              "Seat",
              "Skoda",
              "VolkswagenErhverv",
              "Porsche",
              "Ducati"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a list of leasing groups",
            "schema": {
              "$ref": "#/definitions/GroupArray"
            }
          },
          "400": {
            "description": "If the brand is not valid",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "produces": [
          "application/json"
        ]
      }
    }
  },
  "definitions": {
    "Group": {
      "type": "object",
      "properties": {
        "id": {
          "format": "int32",
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "leasingModelCount": {
          "format": "int32",
          "type": "integer"
        },
        "lowestMonthlyFee": {
          "format": "int32",
          "type": "integer"
        }
      }
    },
    "Error": {
      "type": "object",
      "properties": {
        "code": {
          "enum": [
            "NotValidBrand",
            "NotValidGroupId"
          ],
          "type": "string",
          "x-ms-enum": {
            "name": "ErrorCode",
            "modelAsString": true
          }
        },
        "message": {
          "type": "string"
        }
      }
    },
    "GroupArray": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Group"
      }
    }
  }
}

当我在带有连接器HTTP + Swagger的逻辑应用程序中添加它时,我只能定义{Brand}查询输入,而不是使用{{{}中定义的订阅键(标题或查询)的各种方式。 1}}。

整个SecurityDefiniationssecurityDefinitions部分是在Azure API Management服务中自动生成的,但在Logic App中无法识别。

请参阅缺少订阅密钥字段的图像:

enter image description here

我做错了什么?

更新

我尝试了以下内容:

1 个答案:

答案 0 :(得分:1)

我认为您需要在JSON格式的Authentication-field中指定它。类似的东西:

    { 
         "apiKeyHeader" : "your Ocp-Apim-Subscription-Key", 
         "apiKeyQuery" : "your subscription key" 
    }