This article is divided in 2 parts as below -
- In the first part we will understand the basics of the need of an API management platform.
- In the second part we will do a simple hands on for Azure API management platform to better understand it.
Note : I am assuming that you have a basic understanding of API development & Azure exposure. If not, please first do some hands on & create some APIs/host on Azure App Service to better understand this article.
To make things easier it will be good to understand some problems which arise during an API development process.
Consider Tom(a young, intelligent & energetic guy) joins a company as a Senior Software Developer. He is assigned in a project which uses around 20 APIs behind the scenes. Those 20 APIs are handled/managed by 5 separate teams & Tom is assigned in one of the teams. Now Tom first need to understand all the API's managed within his team like the API's request data, response data, payloads, allowed http actions etc. What do you think Tom will do to accomplish this task? He will gain this understanding through either of any below or all approaches -
- Tom will have some sessions in which somebody from his team will walk him through all these details.
- Tom will keep asking his team members about the details till he understands them all.
- Tom will go through the documentation of APIs which encapsulates all these information.
Now, as you can see that once Tom starts working on any ticket & gets stuck somewhere in any API understanding, he will need to resort to discussing it with team members who may not be available quickly or he will need to refer the documentation.
Do you see the issue here? I see following hurdles -
- Tom's progress is dependent on exterior factors like team member's availability or updated documentation resulting in delay of the completion of Tom's tickets.
- Even if any team member is available & explains him about that API, that team member will need to invest his time which may result in his own work getting delayed.
- Tom or going through the documentation again.
You can gather that Tom's progress is highly dependent on exterior factors like his team member's availability, documentation etc. Furthermore, the documentation would also need to be updated at regular intervals so that it does not get outdated, which in itself will require investment of efforts from the team.
Now what if there is a store online where Tom could go & see the listing of all the API's. What if he can click any of the API & can see it's request data, response data, payloads etc.? What if he can try out any of the API by passing the request and play with it? Yeah. Do you see the benefits & power of this online place? All the dependencies for Tom goes away. He can just login to that online store & acquire the required API knowledge. Productivity increases! So this kind of online store is nothing but an API management platform & Azure provides this type of platform which is called Azure API Management.
I mentioned previously that suppose there are 20 APIs which are handled by 3 separate teams - Alpha, Beta & Gamma teams. Tom is a part of Beta team & suppose now he has acquired all the knowledge of Beta team APIs by discussing with team members, going through documentation etc. Now he is tasked with a functionality for which he has to create a new API. But the catch here is that Alpha team is waiting for this new API completion ASAP because they have to use the response of this newly created API in one of their own API. So to summarize it in bullet points -
- Tom has to create a new API
- Alpha team is to use this newly created API from Tom(Beta team).
- Alpha team can't work till Tom creates this new API.
- If Tom takes 2 days to create this API & Alpha team takes further 2 days to create their own API using Tom's API response then it will take 4 days for the dev completion of 2 APIs!
Is there any way to tackle this issue, so that Alpha team & Tom can start working in parallel? Yes there is. In fact there are 2 ways -
- Tom can provide a hard coded sample json response to Alpha team to use. But the issue here would be that they won't be able to work on integrating the Tom's API. So that part would be left out till Tom completes his API.
- Tom can create the API & output a hard coded response to be used by Alpha team. Though it's better than #1 approach, but this will also require some work to be done first like creating the API, outputting hard coded json response, deploying it on server etc.
Both the above approaches can be used & are actually used at many places to kickstart the work in parallel across interdependent teams, but what if there is a way to achieve it more quickly? What if Tom can go in that API online store(mentioned in #problem 1) & quickly create an API with hardcoded response there itself, to be used by Alpha team? That will be wonderful! And that's exactly what Azure API Management provides. This feature is called API mocking, a really great feature to improve productivity.
Let's suppose Andy is the API lead of the 3 API teams - Alpha, Beta, Gamma. The requirement comes that all the API's need to check first that every request must contain a DomainID httpheader. If this header is not present, API should return 401 unauthorized response. Andy informs all the 3 teams to incorporate this validation inside of their APIs. And the teams quickly implements this validation in all of their APIs by checking this header condition in each & every API. Do you see the problem here?
- Every team would need to get involved in the implementation.
- Every API code would need to be changed resulting in duplication of code and deployment of all the APIs again.
There are efforts & costing involved in this approach in making a small change of http header validation. What if this condition can be implemented at just one place which should work as a blanket policy for all the APIs? What if this change can be done at that online store we are talking about? It should provide huge benefits -
- Only one person would need to be involved to make this change.
- No code changes in any of the API.
- No dev efforts involved.
The Azure API Management provides exactly this kind of feature. We can create blanket policies which can be applied to all of the APIs instantly without even making any code changes.
We have seen how an API Management system provides nice resolutions to some of the problems encountered during API development/maintenance process. Though there are lot many other features which are provided by Azure API Management platform but I have listed only a tip of the iceberg just to make things easier for you so that you can start wrapping your head around it.
We will do a simple hands on for Azure API Management platform in the second part of this article.