In this post, we will see how to create an API Management resource and how to deploy an our Web API service.
But first of all, what is API Management?
From Microsoft web site:
“Azure API Management is a hybrid, multicloud management platform for APIs across all environments. As a platform-as-a-service, API Management supports the complete API lifecycle.
APIs enable digital experiences, simplify application integration, underpin new digital products, and make data and services reusable and universally accessible”
In a nutshell, Azure API Management is a cloud service that helps us to manage all our APIs and it provides a single point of access for all of them.
In Azure API Management we can import our APIs, we can protect our APIs, we can monitor our APIs, we can add multiple versions and so on.
HOW TO CREATE API MANAGEMENT IN THE AZURE PORTAL:
We start opening a browser, we go to Azure Portal and then we click on “Create a Resource”:
Here, we search for API Management and then we push the button “Create”:
In the last steps, we have to insert all information for defining our API Management and then we push the button “Review + Create”:
After the deploying (quite long…), we will be able to see our “API management”:
DEPLOYING AN API USING VISUAL STUDIO:
We open Visual Studio and we create a Web API project, called TestAPI.
By design Visual Studio creates a very easy controller called WeatherForecast but however, for the purpose of this post, it is enough.
If we run the application, this will be the result:
Now, we come back in Azure portal and we add a new API:
Then, we will return in Visual Studio where we will publish our code in the API created above.
We click the right mouse button on the project name and then we select “Publish”:
We have done and now, if we test our API in the Azure url, this will be the result:
From the Azure portal, we can choose many policies for our API using the option Design.
[Inbound processing]
[Outbound processing]
Finally, we can choose which service to send the request to:
Another thing that is very easy to manage, is the versioning of an API.
If we click on the three points near the API’s name, Azure will show a menu where we can add a new version of the API: