Monday 18 September 2017

Web APIs - A timeline of web services (Part I)

Let me start from: How do we access data from a remote system?

In the world of connected systems, where there are all kinds of possible message exchange systems, talk about peer-to-peer, electromagnetic waves (radio, IR and all other types), bluetooth, wifi, there are numerous possibilities of how we can exchange messages with other systems.

As a message exchange standard across www, HTTP stands out as the most used. HTTP stood the test of time and scale! It has perpetuated decades of internet revolution while evolving to fit the needs of computing infrastructure and message exchange.


Web page:

Message exchange over a period of time became synonymous to web page request and response paradigm.

Here's a URL: https://google.com

And the server responds with a beautiful web page which satisfies all your urges for knowledge and wisdom!
This is how most internet services came into existence.
Seek (GET) what you need.
Wait... Are you registered? Sign up (POST).
Only then you see your data!

Session Handling:

Our needs went beyond the request-response (question-answer) style. By nature, we need more than an exchange of information - the context. This is when this miraculous state-saving/state-tracking/state-persisting technology came into existence.


Web Services and web APIs

While the world is happy with the life's answers to our needs through web pages, users asked the providers, "Do I need the overhead of your styles and showmanship when what I am actually using is the fields... only the fields I'm interested in?"

That's when the providers started thinking "Why do I need to have this guy's session on my page? I'm doing so much to keep him happy on the page with all my wooing experience! And still he/she is just happy with the fields".

A superb semantic medium called XML got the users and the providers on the same page

I need
<datafield1>value1<datafield1>
<datafield2>value2<datafield2>

And this is definitely more than what we need
<html>
<head>
<link...>
<link...>
<script...>
</head>
<div>datafield1</div>
<div>value1</div>
<div>datafield2</div>
<div>value2</div>
<body></body>
</html>

When the user doesn't need to stay logged in to their session, the server does not need to do session handling!

  1. More time for server. Less processing because of no session handling and asset manipulation. 
  2. Faster turnaround. Avoid context switching overhead. 
Question: How is it possible? 
Answer: A web service! 

You want to search products using a keyword.

http://www.mysampletesturl.com/search?keywords=smart,phone

And pat comes a result:

<products>
<product>
<id>123</id>
<name>iPhone</name>
<description>coolest of smart phones is here!</description>
</product>
<product>
<id>124</id>
<name>LG Nexus 6</name>
<description>Another coolest of smart phones is here!</description>
</product>
</products>

But this still happens over HTTP! What's the big deal? 
OK, we don't have to process all the additional display components (scripts, heads and bodies). I give it to you! 

What more? 

Continued in the next part...

(Please let me know your feedback in the comments.)

No comments:

Post a Comment