REST API (Part II)



Hi,Here is REST API (Part II)


If you do not know what the REST API is, Please read my previous article REST API (Part I)


REST and API are acronyms for Representational State Transfer and Application
Programming Interface. Rest APIs are integral to web application development and
becoming mainstays of all web development. Understanding what they are and how they
work starts with understanding what these names, representational state transfer,
and application programming interface, actually mean.


According to MDN, Representational State Transfer
'Representational State Transfer(REST) refers to a group of software
architecture design constraints that bring about efficient, reliable, and
scalable systems'


So REST is not a specific technology, but rather a data architecture and
a design methodology that produces predictable and consistent outputs and behaviors
by receiving a set of standard methods called verbs and returning standardized
structured data, typically JSON or XML called theresource.


Representational State Transfer is a literal description of what's happening.


We transition between representations of states and these representations are transformed
back and forth between the application and the server.


To make sense of this, consider a typical website.


Each page comprises a single HTML document containing the content, any reference
items like images, one or more style sheets describing how the document is presented in
the browser, and some javascript manipulating the document or styles or both.
When the visitor navigates from one page to another, they send a URL, Universe Resource
Locator, request to the server pointing at a web resource in the form of a HTML document.
The server responds by returning the document along with its adjoining files to the browser
which replaces the previous content with all new content.


This works fine, but it's resource intensive. Each new page requires a complete
HTML document and the document has to be written by a developer or generated by a
content management system before it's downloaded and rendered in the browser.


Now Imagine instead of a website comprising individual documents generated
and downloaded from the server.
we have a web application. An application downloaded to the browser
that runs in the browser and is populated with data from the web. In this application,
each page is a view representing the current state.
        When the visitor loads the site for the first time,
all the components that make up the application are downloaded including a HTML framework,
referenced items, one or more style sheets, and some JavaScript.
The application then sends a URI (universal resource identifier) request
for a web resource representing the next state of the application to be transferred and uses the resulting data to build the current view.
When the visitor navigates from one view to another, the application sends a new
URI request for the web resource representing the next state of the application which
is transferred and used to add, modify, replace, or delete the previous data.


The key is this representational state is transferred as a data object, not the entire new
set of files. And the application can update its data without rendering the whole new page.
This allows us to create so-called single page applications on the web and native apps for
mobile devices and platforms that all use or consume the same REST resource.


To give a practical example, when you visit LinkedIn on your computer and your
smartphone, you use two different application access the same data from the same REST
resource. All this back and forth is controlled through an application programming interface
or API.


API;
'A set of features and rules that exist inside a software program
enabling interaction between the software and other items, such as other software or
hardware'


In the context of REST APIs, the API is the collection of tools used to access
and work with REST resources through your adverbs including get, pull, put, and delete.


You can think of the REST resource as a librarian and the API as
the language used to talk to them.  Refer to this: Librarian’s Story


Hey Librarian, please get me the 10 most recent articles on digital ethics.
Hey Librarian, please put this document to the library under the Norwegian Folkrole
Category, and please delete this document from the library as it's no longer relevant.
I hope that now you know what REST API is. Read both articles and get the idea.


Thank You...!!!
sanduniisa


What is the Page Ranking Algorithm?  Visit

REST API (Part I)

Comments

Post a Comment

Popular posts from this blog

Federated Learning

Blockchain

REST API (Part I)