Azure API Apps, Azure Logic Apps and the OpenAPI Specification (formerly Swagger Specification)
In this post I will create an awesome .NET Core API using “Swagger Code Gen”, I will deploy it to an Azure API Service and then I will create an Azure Logic App that will integrate it with my personal Twitter account.
Swagger
Swagger is a framework that aims to simplify the development of APIs and aims to do that by providing standards and tools to the developer community.
Notable achievements were the creation of the “Open API Specification”, donated to the Linux Foundation in 2015.
Swagger also comes with powerful tools such as the “Swagger UI”, “Swagger Codegen” and the “Swagger Editor”.
By using these tools, the developer is empowered with creating clients and servers stubs without having to write a single line of code.
How this is achieved is by translating an Open API Specification instance into a real Web API written using a language chosen between those supported featuring today those more in demand such as C#.
I will connect to “http://editor.swagger.io/” and I will download the example pet store API.
I personally had some problem opening the project as I was receiving an anonymous error message stating the project could not be loaded.
As shown in this answer the solution to this problem was here:
I did manually remove the project from the solution file itself as doing it via UI did not have any effect on my solution.
All the methods are stubbed:
Deploy the API
Next step is to deploy the code to a resource called “API App” that I called “OpenAPITest”:
Azure API Apps are App services:
And here the result:
Create a Logic App
Logic apps allow for easily integrate SaaS.
In demand APIs like Twitter’s or Facebook’s have their own matching connector implemented inside Azure.
Logic Apps allows also to integrate them with Swagger’s APIs.
I will then paste the URL of the newly created swagger application:
And select the method “Find Pets by status”:
Result:
The logic app will poll the service every 3 minutes and search for all the pets that are available.
Send the results on Twitter
I will now try to post the call results on my Twitter account.
Result
Summary
Integrating SaaS using Logic Apps and can potentially save plenty of time