ASP.NET OpenAPI makes it very easy to automatically document our Web API projects. In addition to automatic documentation, we can also use Azure API Management to integrate OpenAPI automatically documented Web API into the most popular low-code applications today. In this article, I’ll show you how to string together Azure Functions, Power Apps, Logic Apps, and other Azure services using Azure API Management. Azure API Management is able to leverage documented API definitions to expose our API endpoints, which can be easily used in low-code applications. To see how simple it was: https://www.bilibili.com/vide…

Import your API into Azure API Management

With the release of Visual Studio 2019 16.9, we have added support for publishing to existing Azure API Management service instances and creating new consumption pattern instances of Azure API Management, so as long as you are an Azure customer, You can then use API Management’s monitoring, security and integration capabilities when needed.

When you publish an application that has integrated SwashBukle.AspNetCore(the default integration option in ASP.NET Core 5 Web API projects). When a Net Core API project enters Azure App Service, the Azure API Management TAB will appear in the Publish dialog. You can either select an existing Azure API Management instance or create a new one.

Once the release is complete, you will be able to test your API directly in the Azure API Management portal. From here, you can also monitor traffic, control access rights, and export APIs to other services (you’ll see how to export APIs to other services in the next section of this article).

Note: You can only create a new consumption pattern instance of Azure API Management in Visual Studio. This is a lightweight, serverless version of Azure API Management, charging per execution and offering 1 million free calls per month. If you have an existing instance of Azure API Management, you can also import it into it. This feature can be used for any service level of Azure API Management.

If you are not familiar with Azure API Management, You can learn more about publishing APIs to Azure API Management using Visual Studio or Visual Studio Code at docs.microsoft.com.

Azure API Management:

https://translate.google.com/…

A lightweight, serverless version of Azure API Management, charged per execution, with 1 million free calls per month:

https://azure.microsoft.com/p…

Visual Studio:

https://translate.google.com/…

The Visual Studio Code:

https://translate.google.com/…

Build the workflow using your API and Logic Apps

Once you publish Web APIs or Azure Functions that include OpenAPI (included in the sample code base attached to this article), you can use Azure Logic Apps to use them in business workflows, timed tasks, or event-triggered processes. The Logic Apps Designer automatically chooses to import all APIs in an existing Azure API Management service instance, making it easy to determine which APIs are available.

Because the Logic Apps designer knows how to draw the OpenAPI documented definition for the API I imported in API Management, it’s easy to figure out which API I need to call to create a repetitive inventory check process.

Extend the workflow using Azure Functions

By introducing OpenAPI extensions to Azure Functions, you can export your OpenAPI descriptions from Azure Functions in the same way that you can export OpenAPI descriptions from WebAPI Controllers using NSWAG and Swashbukle. In the sample code, you’ll find a notification feature that builds an Adaptive Cards that summarizes the inventory status of low-grade products. Using the OpenAPI extended feature properties, Azure Functions can be documented using OpenAPI and imported into Azure API Management.

public static class InventoryNotifier { [OpenApiOperation(operationId: nameof(SendLowStockNotification), Visibility = OpenApiVisibilityType.Important) ] [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Product[]), Required = true) ] [FunctionName(nameof(SendLowStockNotification))] public static async Task<IActionResult> SendLowStockNotification( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log) { // function code... }}

Once imported into Azure API Management, you can use these Azure functions in complex Workflow applications such as Logic apps. For example, I can design a Workflow in Azure Portal that mixes the pure Web API with the Azure Function exported to Azure API Management using OpenAPI.

Example codebase:

https://translate.google.com/…

OpenAPI:

https://translate.google.com/…

The Adaptive Cards:

https://translate.google.com/…

Use your API to build Power Apps

If you’re building ASP.NET Core Web APIs and Azure Functions in an environment that uses Office 365 and Power Apps, Azure API Management can take advantage of your HTTP API development talents. The API Management APIs can easily be exported to the Power Platform as custom connectors.

Here, I have started building a mobile application that can be distributed to any user in Microsoft 365 Tenant. Because I’m just getting started, I quickly add the custom connector I just created that will connect the Power Platform to the hosted API in Azure. When I add the new “Refresh” button, a formula input box appears when I mouse over it, in which I call the ClearCollect method to clear the collection variable ProductCollection, The collection is then re-populated using the storeapis.getProducts operation.

The beauty of Power Apps is that it can be data-bound even in design mode. So instead of running it over and over again when I develop the application, the data will always be bound to the right controls.

If you are not familiar with how to use OpenAPI to document your API, you can refer to our previous post:

  • Create a discoverable HTTP API using ASP.NET Core 5 Web API

    https://translate.google.com/…

  • Open source HTTP API packages and tools

    https://translate.google.com/…

  • Generate the HTTP API client using Visual Studio Connected Services

    https://translate.google.com/…

  • Building applications with Azure API Management, Functions, Power Apps, and Logic Apps (this article)

conclusion

In this series of articles, we start with some general guidelines for ensuring that the API is properly documented using OpenAPI, and then discuss various open source projects and tools that can make it easier for you to design, build, and test APIs. Finally, you were shown how to use these documented APIs in a variety of application build and integration scenarios. Hopefully, these will give you some new tricks and some inspiration to build APIs and applications more happily on future projects.

What’s the next step?

We are happy to be able to share the entire end-to-end with you in this series. NET HTTP API developer experience. Hopefully you’ve seen it. NET helps you build high-quality APIs that integrate well with industry standard specifications, community projects, and Microsoft tools such as Visual Studio and Azure.

If you are experienced. NET developers, can be in. The.NET documentation delves into some of the more advanced topics, or you can check out the source code in this blog series.

The.net document:

https://translate.google.com/…

In this blog series:

https://translate.google.com/…

The source code:

https://translate.google.com/…