Muokkaa

Jaa


Import a Logic App as an API

APPLIES TO: All API Management tiers

This article shows how to import a Logic App as an API and test the imported API.

Note

Currently, this feature isn't available in workspaces.

In this article, you learn how to:

  • Import a Logic App as an API
  • Test the API in the Azure portal

Note

API Management supports automated import of a Logic App (Consumption) resource. which runs in the multi-tenant Logic Apps environment. Learn more about single-tenant versus multi-tenant Logic Apps.

Prerequisites

Go to your API Management instance

  1. In the Azure portal, search for and select API Management services.

    Select API Management services

  2. On the API Management services page, select your API Management instance.

    Select your API Management instance

Import and publish a back-end API

  1. Navigate to your API Management service in the Azure portal and select APIs from the menu.

  2. Select Logic App from the Add a new API list.

    Select logic app category

  3. Press Browse to see the list of Logic Apps with HTTP trigger in your subscription.

    • Logic apps without HTTP trigger will not appear in the list.

    Browse for existing logic apps with correct trigger

  4. Select the logic app.

    Select logic app

  5. API Management finds the swagger associated with the selected app, fetches it, and imports it.

  6. Add an API URL suffix.

    • The suffix uniquely identifies this specific API in this API Management instance.

    Finish up fields

  7. If you want the API to be published and available to developers, Switch to the Full view and associate it with a Product. We use the "Unlimited" product in this example.

    • You can add your API to a product either during creation or later via the Settings tab.

    Note

    Products are associations of one or more APIs offered to developers through the developer portal. First, developers must subscribe to a product to get access to the API. Once subscribed, they get a subscription key for any API in that product. As creator of the API Management instance, you are an administrator and are subscribed to every product by default.

    Each API Management instance comes with two default sample products:

    • Starter
    • Unlimited
  8. Enter other API settings.

  9. Select Create.

Test the API in the Azure portal

Operations can be called directly from the Azure portal, which provides a convenient way to view and test the operations of an API.

Test the logic app

  1. Select the API you created in the previous step.

  2. Press the Test tab.

  3. Select the operation you want to test.

    • The page displays fields for query parameters and headers.
    • One of the headers is "Ocp-Apim-Subscription-Key", for the product subscription key associated with this API.
    • As creator of the API Management instance, you are an administrator already, so the key is filled in automatically.
  4. Press Send.

    • When the test succeeds, the backend responds with 200 OK and data.

Append other APIs

You can compose an API of APIs exposed by different services, including:

  • An OpenAPI specification
  • A SOAP API
  • A GraphQL API
  • A Web App hosted in Azure App Service
  • Azure Function App
  • Azure Logic Apps
  • Azure Service Fabric

Append a different API to your existing API using the following steps.

Note

When you import another API, the operations are appended to your current API.

  1. Go to your Azure API Management instance in the Azure portal.

    Screenshot of navigating to API Management instance in the portal.

  2. Select APIs on the Overview page or from the menu on the left.

    Screenshot of selecting APIs on Overview page in the portal.

  3. Click ... next to the API that you want to append another API to.

  4. Select Import from the drop-down menu.

    Select import

  5. Select a service from which to import an API.

    Screenshot of selecting a service in the portal.

Note

Every Logic App has manual-invoke operation. To comprise your API of multiple logic apps and avoid collision, you need to rename the function. In order to rename the function/API, please navigate to the OpenAPI Specification editor and change the title value.

Next steps