All Content
Timespan
explore our new search
Using Power Automate Flows for API Integration Solutions
Image Source: Shutterstock.com
Power Automate
Oct 20, 2022 9:19 AM

Using Power Automate Flows for API Integration Solutions

by HubSite 365 about Michael Megel

Enterprise Architect, Azure DevOps, Power Platform Addict, Cloud Solutions & Intelligent ERP ... Never stop learning!

Citizen DeveloperPower SelectionPower AutomateM365 Hot News

Maximize your Microsoft Power Automate flows by turning them into APIs and elevate your solutions across environments. Explore the how and why here!

Michael Megel's recent blog post describes the potential of using Power Automate Flows as API. The author illustrates situations where this could prove beneficial, especially with the growth of the citizen developer community and the increasing solutions being created through Power Platform.

An interesting scenario was shared where the author had two Power Platform solutions. The first solution uses a Power Automate Flow to handle all business logic which involves accessing data from an Excel file stored in OneDrive, while the second solution uses a Canvas App that is designed to utilize the data from the first solution.

Communication between these two solutions is enabled through the use of another Power Automate Flow featuring a "Request Trigger". This, in effect, exposes an HTTP endpoint which the second solution utilizes via a custom connector. Despite the viable setup, complications may arise when the first solution is being rolled out from the Development stage to the Testing stage, and subsequently to the Production stage.

In a bid to avoid such potential hindrance, the author incorporated an API Management Gateway in his structure - a mediator between the API publisher and the consumer. Post provisioning, an HTTP API is defined manually with a suffix and version attached to it.

In addition, an operation for the Power Automate Flow is created. This serves to read and manage the books. Setting up policies was the next part, and it has been identified to be a tad complex as API calls need to be directed to the Flow trigger.

The author reassured readers that API Management Gateway policies have the ability to modify the functionality of an API through configuration. Examples of this include modifications to the Base-URL, setting a new HTTP of "POST", rewriting Uri, adding query parameters among many others.

In summary, Michael explores the idea of using Power Automate Flows as API explaining its effective role in decoupling or reusing existing Power Platform solutions and in extending functionalities. He also highlights the fact that using an API Management Gateway offers the possibility to replace underlying services when needed.

More About Power Automate in General

Power Automate is a service provided by Microsoft that assists in automating repetitive tasks such as synchronization of files, data collection, and much more. It maximizes productivity with a considerable degree of effectiveness and efficiency. Its use is spreading among businesses - and with a growing developer community, the future seems promising. You can learn more about it here.

Read the full article Power Automate Flows as API

Power Automate - Using Power Automate Flows for API Integration Solutions

Learn about Power Automate Flows as API

If you have spent some time exploring Power Automate Flows and APIs, you may discover a way to marry these two for seamless process automation. For some, the idea of creating an API based on Power Automate Flows might sound extraordinary, but it holds immense value, especially considering the rapid growth of the Citizen Developer Community and the continual development of Power Platform solutions.

How does it work? Let's break it down using a simple scenario: Suppose you have two separate Power Platform solutions, Solution 1 and Solution 2. Solution 1 handles all business logic and uses Power Automate Flow to access data from an Excel file stored in your OneDrive. In contrast, Solution 2 consists of a Canvas App where data fetched from Solution 1 is desired. The challenge is that these solutions exist in different environments and have different creators.

To initiate communication between Solution 1 and Solution 2, a Power Automate Flow can be employed with a "Request Trigger". This will expose an HTTP endpoint as an API for Solution 2 to use through a custom connector. While this setup works reasonably well, difficulties arise when moving Solution 1 from Development to Testing, and finally to Production. The end game here? Decoupling.


How does one achieve this decoupling? Enter the API Management Gateway, which serves as a mediator between the API publisher (Solution 1) and the API consumer (Solution 2). This gateway, deployed via Azure Portal, adds another critical layer to the mechanics of both solutions' communication.

After setting up the gateway, one can manually define a new HTTP API, creating a new operation for the Power Automate Flow. API Management Gateway policies play a crucial role in modifying the behavior of the established API.

In order to direct the API call to the Power Automate Flow trigger, an inbound policy must be employed. Fortunately, this process is made more straightforward with policy fragments, code-saving measure in the API Management Gateway. Through these fragments, one can assign various elements like backend service, method, path, query parameters, etc.


Adding to the optimization, variables can also be utilized in the operation policy. These can help specify the details of the HTTP-Trigger URL, the HTTP method, and the value of the query parameter:

  • flowUrl
  • sig
  • method

Also, the fragment containing the reusable policy snippet can modify the request based on these variables.

Now, back to our initial question - Does it make sense to set up and create an API based on Power Automate Flows? As always, it 'depends.' We can argue the potential merit of decoupling or reusing existing Power Platform solutions. Smaller, focused solutions are typically easier to manage, especially when discussing Application Lifecycle Management. Moreover, employing an API management gateway offers the possibility of replacing the underlying service without breaking the consumers.

Considering all these points, this pattern is set to become increasingly common in the future. With this, you can replace a Power Automate Flow solution with alternatives, such as a Logic App, App Service, or Azure Function, resulting in higher manageability. Time to explore this powerful tool at your disposal further!

More links on about Power Automate Flows as API

Work with cloud flows using code - Power Automate
Jun 15, 2023 — Learn how to work with cloud flows using code using the Dataverse SDK for .NET and Web API.
How to use an API with Power Automate
Apr 14, 2021 — This post helps you to get started with APIs in Power Automate; What is an API, basic terminology explained and a example of API cloud flow.

Keywords

Power Automate Flows API, API Automation, API Flows, Microsoft Power Automate, Automate API, Power Automate as API, API Workflow Automate, Microsoft Flows API, Power Automate API Integration, Power Automate API Tools