Monday, October 3, 2016

API Testing - From knowing what's an API to the time that saw birth of REST



It seems to be uncommon if said I do not know what is a function, library, class, protocol and binaries in the Computer Science & Engineering.  Extending to this, it is more likely and usual to hear the word, the API - Application Programming Interface.

Have you read this which is so common if you are building and testing the APIs?


What is an API ?

Before walking into this discussion, let me try to understand what is an interface! Yes, an interface. Let me split this word and see what I see.

I see, "inter" and "face".  That is, there is a face between the inter -- which can be one or more.  A face as a property and attributes, isn't it?  So when I have an option to inter look in the face and take what's available there, I say, -- "I need it or I need some of these which can help me in ....."

From an API, I need it or I need some of these which can help me in doing what I want to do in the software system environment.  Further learning what is -- Application Programming, it is the programming of an application what is put in the environment to do the expected on purpose.

Now this Application Programming having an Interface so there can be a communication with methods or using the methods (functions) and it's associative elements. Upon communication, transfer of the messages i.e. data happens between within the system and also between the systems.

An API is (set of) programming instructions that is used to build the software application.  The context defines, what is the API there and how it will be used.  This further classifies the APIs now into types and it is briefed below.


Types of API

An API can be everywhere and to be so, it can be in the below said contextual forms.

  1. Software Library API
  2. Hardware System API
  3. Web based API
  4. Operating System API
Each of above said types further classified much more and in detail. Overall, in general these types covers most cases as I understand at this point of time in my practice. If you happen to see and using it beyond this, kindly let me know; it will help me to learn.

The API which aids to talk between two and more technologies or within the technologies, helps to pick what is needed alone and work on it. The encapsulation and interface idea of Object Oriented Programming can be seen in concept of the APIs and in the programming of it.



REST Architectural Design for the Web

All of sudden it appears like the word 'REST' is so new in the technology world, when one hears it for the first time and subsequently.  Well, the word REST in the Web exist since year 2000 and around somewhere.

Going bit more back in years, in the December of 1990, Tim Berners-Lee started a non-profit software project called World Wide Web to facilitate the sharing of knowledge. Working for a year, he had invented and implemented the below.

  1. URI - Uniform Resource Identifier
  2. HTTP - HyperText Transfer Protocol
  3. HTML - HyperText Mark-up Langauge
  4. The first web server - it is still up and running at http://info.cern.ch
  5. The first web browser which Tim Berners-Lee named as "World Wide Web" and he renamed it as 'Nexus' later to avoid the confusion with the web.
  6. The first WYSIWYG HTML editor - it was built right into the browser.  WYSIWYG is an acronym for What You See Is What You Get.
In 1991, Tim Berners-Lee wrote on the Web's first page as below
The WorldWideWeb (W3) is a wide-area hypermedia information retrieval initiative aiming to give universal access to a large universe of documents.

Since then, the Web took it's growth rapidly. In 1998, as I have witnessed, the results of exam were published on the web by the education board in state Karnataka. Then the chat room asking 'ALS please' and as this.  Today while I write this, there is a Big Billion Day and Grand Annual Sale happening by the retail competitors of India where the customer purchases over the web via website and mobile app, thereby making the crores of rupees transactions in a day for business.

Getting back to 1990's, Roy Fielding, co-founder of the Apache HTTP Server Project was concerned for the Web's scalability problem in 1993. He and his fellow practitioners, observed Web's scalability constraint and came forward to improve it.

Roy Fielding grouped the constraints into six categories and he referred them as the Web's architectural style and it is as below:

  1. Client Server
  2. Uniform Interface
  3. Layered system
  4. Cache
  5. Code-on-demand
  6. Stateless
Along with Tim Berners-Lee and others, Roy Fielding worked to increase the Web's scalability and wrote the specification for the new version of HTTP 1.1.  These standards were adopted across the Web and contributed to the growth of World Wide Web.

Hey, you know, if HTTP is used in the software application you are building, the skilled practitioner says to use HTTP 1.1, so the caching techniques can be derived on using it upon mentioning it. The network attribute optimization, you see!

On avoiding the Web's scalability problem, Roy Fielding named and described the Web's architectural style in his PhD dissertation, in year 2000. He gave the name Representational State Transfer (REST) to his description of the Web's architectural style which is composed of above said constraints.

REpresentational State Transfer (REST) -- is the name of the description or derivation of the Web's architectural style.




What is in the next post? In the next post of this series, I will walk through the thought of
  1. Web API
  2. Restful API
  3. REST API -- Is this a right way of saying it ?



3 comments:

  1. Thank you @Ravi, for sharing such a brilliant post, very informative, please share a many like this.

    ReplyDelete
  2. To me an API is a unit of software program (function or a class or any similar unit) that is used by yet another software program. In other words a piece of code whose (end) user is another software. For example "strcpy" or "printf" function OR String or System class of JDK. These program pieces cannot be used meaningfully by a human end user (not programmer) but only by another program (of course with help of a programmer). In one sense you can think of API is building blocks of a program. Some API's need to be exposed in order to be used by another programmer. Some popular contemporary examples of API are Twitter, Google search API's that could be used in other web or desktop applications.

    ReplyDelete
    Replies
    1. Hello Shrini,

      Yes! An API exposes a set of data and functions to facilitate interactions between computer programs and allow them to exchange information.

      The Web API will be the face of a web service by directly listening and responding to client request. Typically web API looks like as below in an overview.

      {client} <--- request & response ---> {Web API {Web Service backend} }

      APIs are very common today in the daily life. With out the APIs the world look so complicated.

      Delete

Please, do write your comment on the read information. Thank you.