Application Programming Interface, commonly known as API, is a set of functions that allow downstream applications capability to access the features or data of a black box business application. In the current age of computer applications, APIs are abundantly available and are the cornerstone of business strategies; however, the beginning of APIs consisted of confusing approaches related to documentation and implementation of the code coupled with the high code complexity. Initially, the concepts of middleware, such as CORBA and RPC, capable of some interoperability gave rise to API frameworks, such as SOAP.
Simple Object Access Protocol (SOAP) is advertised as a simple general-purpose API framework capable of complete interoperability. If true, this could have addressed many of the issues faced by the previous solution of middleware proposed to solve the same problems. SOAP did pave the way to better interoperability in the client-server application model; however, it was far for being either general-purpose or straight forward. SOAP was based on XML and was hard to code as well as it proved difficult for third parties to understand and interact with. In addition to this, SOAP APIs were not efficient regarding server resource management.
In 2000, Roy Fielding presenting the concept of REST API in his Doctoral Dissertation. Based on his initial suggestions as well as input for the developer community, following essential concepts related to REST API:
- Uniform interface: Use of HTTP verbs (GET, PUT, POST, DELETE) with URIs as resources should be used for a HTTP response with a status and a body.
- Stateless: The requests are self-descriptive for the purpose of clarity for the server to process that message.
- Client-server: There needs to be the clear difference between the caller (client) and callee (server) applications.
The REST APIs are to some extent simple and easy to implement as well as efficient and interoperable. In addition to this, REST API is current supported by all the cloud providers specially Amazon.
Even though quite useful, the REST APIs has some shortcomings which have come to light due to the change in the nature of business application. Among many other issues, one biggest and central to death of the REST APIs are the real-time application, such as stock exchange /selling applications. This has paved the way towards a new type of APIs named as GraphQL.
The GraphQL is a query language for APIs and runtime for fulfilling those queries with existing data. In addition to this, the GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. For further understanding, in a standard REST API, the endpoint is the identity of the called object whose shapes, and size is determined by the server. On the other hand, in the GraphQL, the identity is separate from endpoint and the server declares the available resources, while the client request what is required. Moreover, importantly the GraphQL API framework is implemented by the Amazon Web Services (AWS). In this series of articles on the GraphQL API, we will explore AWS implementation of the API specially related to real-time data applications, such as stock exchanges and chatting applications.
Finally, in this article, we have took at a very brief preview of the past technology that played important role in the development of the current paradigm of REST APIs. In addition to this, problems with previous technologies and how they are different to the REST APIs are also touched on. In the end we intrdouced new GraphQL APIs and important difference between the two framework.