Leveraging Microsoft Flow to be your API Engine – Low Code Approach

Recently I’ve been experimenting with Microsoft Flow and its counterpart, Logic Apps. A thing that I noticed could become a game changer in designing a business solution these days is that Microsoft Flow can be turned into an API engine. In my example, I’m going to create a very simple API to send a message to my Skype for Business and reply back with the response whether the API call is successful or not.

The first step is by registering the HTTP Request trigger in the Flow step:

HTTP_Request_Trigger.png

As any typical API, you will need to specify the data payload. To generate the payload schema, we can use the “Use sample payload to generate schema”. I’m going to use a simple payload to send the message:

{
      “message”:”payload for skype”
}
Payload_generator.png
Once generated, this will create the schema for you
HTTP_Request_Trigger_with_schema.png
To ensure that the payload schema is validated on the HTTP request by clicking the Settings option:
Settings.png
And turn the Schema Validation to On
Schema_Validation_On.png
The next step is to register the action that you would like to perform (you could be creative here with the available connectors for Microsoft Flow or you can come up with your custom connector).
In my sample, I’m going to add the Skype for Business action: Send Instant Message
Send_skype_message.png
As any typical API, we will need to provide the response appropriately. In this example, I’ll just implement the success response. Exception handling will be discussed on a separate blog post.
response.png
Once finished, save the flow and the HTTP Request step will generate the API endpoint:
endpoint.PNG
To test the endpoint, you could simply use Postman (or any tools to stimulate HTTP request) to trigger it:
Postman.png
And here’s the result:
Skype.png
Skype2.png

Conclusion

To create a low-code API is now become very simple with Microsoft Flow. With the available connectors and actions, workflow-based API can be achieved in configurations!

Leave a comment