To create, deploy and use a custom Connector that can be used in Azure Logic Apps. We also want to be able to publish this connector in the gallery (so that it shows up in the list with other connectors). For now the latter appears to be primarily available as invite-only for Microsoft partners.
During my research it became clear that Azure and the Microsoft Flow services are constantly changing, both in terms of functionality and user interface. What follows are based on my experience at the time of this writing. By the time you read this there have likely been additional changes.
Logic Apps are an outgrowth of BizTalk and various workflow platforms from Microsoft. They are a way to build workflows that can integrate with a variety of external services. Think IFTTT with the ability to provide more logic, or Yahoo! Pipes.
Flow is kind of a “lite” version of Logic Apps. Flows use the same connectors as Logic Apps, but expose less of their functionality and have fewer options for linking connectors. Microsoft Flow is a direct competitor to IFTTT.
Workflows in both consist of actions. These actions come in two flavors:
There are already several good tutorials on-line that cover the basics of creating Flows and Logic Apps, so I’m not going to go into that here. These are a few that I recommend:
Because Microsoft Flow and Logic Apps both allow the user to select the same connector/actions from the gallery, we will start by adding our Custom API to Flow. Once there it can be rolled out for Logic Apps.
If you don’t need your custom API to be in the gallery where other users can select it to include in their own Flows the easiest way to access it is with one of the built-in connectors:
What we’re looking to do, however, is provide our own branded connector that customers can choose from the gallery instead of one of the built-in HTTP connectors. In Microsoft Flow, this is referred to as a Custom API. In Logic Apps this is referred to as a connector.
To register a Custom API for use in your flows click the gear icon in the top right and select Custom APIs.
On the next page click the Create custom API button:
When done click Create API in the top right. If successful, your API should be listed on the Custom API page. From here you can create Connections, edit or remove the API.
You may have noticed near the end of the steps in the previous section that a lot of cleanup was needed on the Definition screen. Maybe you needed to provide friendlier names, descriptions or set visibility.
Microsoft has provided the following extensions to the Swagger specification which covers some of these situations:
For more details see Customize your Swagger definition for Microsoft Flow.
Maintaining these extensions in your API’s Swagger by hand could become a real headache, so a Microsoft MVP by the name of Nick Hauenstein has created a library for that. T-Rex extends the Swashbuckle library, which generates Swagger for ASP.NET WebAPI applications, with additional attributes to generate the Microsoft extensions listed above.
Here is an example from the T-Rex documentation:
[Trigger(TriggerType.Poll, typeof(SamplePollingResult))] [Metadata("Roll the Dice", "Roll the dice to see if we should trigger this time")] [SwaggerResponse(HttpStatusCode.BadRequest, "Bad configuration. Dice require 1 or more sides")] [HttpGet, Route("diceRoll")] public HttpResponseMessage DiceRoll(string triggerState, [Metadata("Number of Sides", "Number of sides that should be on the die that is rolled")] int numberOfSides, [Metadata("Target Number", "Trigger will fire if dice roll is above this number")] int targetNumber)
NOTE: At the time of this writing the stable release of T-Rex only includes support for the summary, visibility and trigger extensions.
After the Custom API has been registered you will need to create a connection to it before it can be used in a Flow.
From the Custom API page, click the plus (+) icon for the API you want to connect to. Enter the connection information when prompted then click the Create Connection button.
That’s it! You can now select your Custom API from the list of actions in a Flow.
Following the previous steps, your Custom API will only be available to you, your team and others you share it with – using the same connection (including credentials) you created. It will not be available to all Flow users. Nor will it be available to Logic Apps.
To get your Custom API into the public gallery, where it can be used by anybody, you will need to contact Microsoft. They will review and test the Custom API and, if approved, make the necessary changes to require each user to set up their own connection. Only then will they make it available to all users.
Once your Custom API is in the Flow gallery Microsoft will incrementally roll it out across data centers for use in Azure Logic Apps.
So, I’ve been working for K2 for about a year-and-a-half now and am still enjoying being part of an actual software company again. Today I found out they’ve produced a new How To video for the product I’ve been the primary developer on for the last year or so.
This component is a broker that connects to a RESTful web service and exposes its entities and methods as K2 SmartObjects – which can be used in workflows, reports and other K2 blackpearl or Appit processes.
The area outlined by the blue box below is the functionality I am responsible for:
]]>