{{announcement.body}}
{{announcement.title}}

APIs ≠ Only REST

DZone 's Guide to

APIs ≠ Only REST

When you think of APIs, what do you think of? REST? This developer argues for why REST shouldn't be the only thing you think of when you think of APIs.

· Microservices Zone ·
Free Resource

My personal experience is that many people assume that whenever I talk about APIs, I am talking about REST. Not only people, even big organizations, banks, and companies limiting themselves to considering APIs only to REST. However, in reality, that is not the case. I agree that REST has been the dominant design pattern and enjoyed a lot of popularity over the last decade. However, REST is just a kind of API that leverages the web. Overall modern API toolbox includes variety of standards and methodologies like REST, real-time Streaming,  gRPC, event-driven architecture and many more. Before we go in details about terms mentioned, let's understand API little bit in detail.

Application Programming Interface (API)

Application Programming Interface (API) is an interface that defines the interaction between different software systems. It mainly defines how one system will communicate with another, which protocol it will use, what convention to follow etc. For example, I heavily work in Java, so I will take an example from Java API only. So, in Java, to communicate with databases, Java provides API which has interface and classes which define how you can connect with Different-2 databases and how to query the database. However, exact implementation is not with Java but with different database providers like Oracle, MySql, PostGre, etc. So the developer provides the database details and connects with it using API provided by Java. An API can be completely custom, specific to component or designed keeping industry standards in the mind for public usage and achieving inter-operability.  Until now we only talked APIs and not the REST. 

What Is the Purpose of Having APIs? 

APIs are simplifying programming by abstracting the complexity of underlying implementation and only providing objects or action which developer or consumer need. For example, as a Java developer you hardly bother, how Oracle has implemented its DB, you only care about class and methods provided by Java to access DB objects and perform the operations.

API Toolbox or Different APIs

API toolbox is nothing but an API landscape which got evolved over the last few years and will definitely continue going forward. API toolbox

In the above diagram, I tried to put some of the APIs available (not all) and you can see clearly all are not RESTFul API and some of them even not using HTTP as the communication protocol. Some of them will use TCP/IP , STOMP or browser, etc. The same way every language provides APIs for communicating with other systems. In this article, I am not explaining, how these individual APIs work but the idea was to give you brief about APIs available.  

REST (Representational State Transfer) is an architectural style which provides some architectural constraints . If your API applies those constraint then you can call API as RESTFul API. 

Conclusion

I hope it is clear now that APIs are not equal to only REST. So chose your APIs carefully which suit your or your organization's requirements and do not restrict yourself thinking about APIs as RESTFul only. 

Topics:
api

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}