Jacob Møhl
Jacob Møhl

Reputation: 46

Missing Subscription Key field in Swagger API connector (trough Azure API Management) in Logic App

I have created a REST API with a Swagger/OPEN API specification which I will like to consume trough a Azure API Management tenant in a Logic App.

When I download the specification it looks like this:

{
  "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"
      }
    }
  }
}

When I add this in a Logic App with the connector HTTP + Swagger I only get to define the {Brand} query input but not the various ways of using the Subscriptions key (header or query) as defined in SecurityDefiniations.

The whole securityDefinitions and security section are automatically generated in the Azure API Management service, but not recognized in Logic App.

See image of missing subscription key field:

enter image description here

What am I doing wrong?

Update

I have tried the following:

Upvotes: 0

Views: 1439

Answers (1)

Steven Van Eycken
Steven Van Eycken

Reputation: 566

I think you need to specify this in the Authentication-field in a JSON format. Something like:

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

Upvotes: 1

Related Questions