REST or REpresentational State Transfer, Its a huge buzzword all around. Software Development companies are talking about the REST APIS, Software Developers are talking about the RESTful Architectures and Interviewers are talking about the Jax-RS Specification for REST APIs. Now
As Interviewer saw your resume, possibly you have written ‘REST’ keyword on your resume and may-be you have designed/developed the REST APIs for some of your web based project. Also the applied job position need a REST API designer and developer.
so Interviewer asked this question from Interviewee – “What is REST API OR What is REST OR What is Representational State Transfer OR What is Architecture Style with REST OR What is Representational and State Transfer in REST “, his mindset was to start a discussion on REST API .
You have work a lot on it, but How to explain the concept of REST to Interviewer, If this interviewer not highly technical then ?.
He possibly doesn’t want to listen standard way of saying, “REST is an Architectural Style”, “REST Stands for Representational State Transfer”. Interviewer not happy from this ?, then what ?
Architectural Style for what ?, Architectural Style for Web Services or Architectural Style of Service Oriented Applications ?. How APIs are mixed with an Architectural Style. Do we need to clearly explain about the REST Style Architecture with API ?
What is REST ?
Below example talk about one of the approach to explain about REST.
Lets got to history, Talk about the Roy Fielding Research – “Architectural Styles and the Design of Network-based Software Architectures“. Its a big paper and talks a lot of various stuff. But as a standard engineer How you would like to explain the clear meaning of REST, and what is its Architectural Style.
Here is one of the way to explain – “What is REST”.
See this www(world wide web) running on top of various hardwares e.g. routers,servers,browsers,firewalls,cloud infrastructures,LAN,WAN. The overall objective of this www(world wide web) to distribute hypermedia. This world wide web equipped with various services e.g. informational based services, websites, youtube channels, dynamic websites, static websites. This world wide web uses HTTP protocol to distribute hypermedia across the world with a client/server mechanism, on top of TCP/IP or other appropriate network stack.
This HTTP protocol is using eight methods to manage the ‘protocol of distribution’ or ‘Architectural Style of Distribution’. Those eight methods are namely : OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT.
But on Top of this HTTP, web applications are using its own way of distributing hypermedia e.g web applications are using web services which are highly tied with clients and servers ‘or’ web applications are using its own way of designed client/server mechanism to make such distribution channel on top of HTTP.
What Roy Fielding Research says , that these eight methods OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT of HTTP are so successful to deliver HyperMedia to all across the world on top of variety of hardware resources and network stacks with client/server mechanism, Why don’t we use the similar strategy with our web based application as well. On this GET,POST,DELETE and PUT are used the most. so four methods deliver HyperMedia to all across the world.
In REST Architecture Style application, a web application need to design the business logic(resides in a server e.g. Tomcat,Apache HTTP) with all set of object entities(e.g. Customer is an entity) and possible operations(e.g.‘Retrieve Customer Information based on a customer id’) on them. Those possible operations with these entities should be designed with four main operations or methods namely- Create,Retrieve,Update,Delete(CRUD). These entities called as resources and these are presented or represented in a form e.g. JSON or XML or something else. We have Client(Browsers) who calls Create,Retrieve,Update,Delete(CRUD) methods to perform the appropriate function on such resource resides in the Server.
But as explained the concept of Representation, means the way entities of business logic or objects are represented. but what about with ‘State Transfer’ ?.
The state transfer, its talks about the “state of communication” from Client to Server. It talks about the design of ‘state transfers’ from Client to Server e.g. Client first called the operation ‘Create Customer’, after calling this what would be next state of customer or states of customer which ‘client’ can call. Its state may be to ‘retrieve the created client data’, ‘update the client data’ or what
It’s a one of the way that explained the meaning of REST , and the discussion continued..e.g. “Design a X System with the concept or practice you made with REST API”, “What is the difference between POST and PUT”, “How ‘state transfer’ design will work with your designed REST APIs”, “Why did you used Jersey over Apache CXF”, “Have you studied JAX-RS Specification?”,”Have you used Swagger”, “What are the six constraints with REST API(Uniform Interface – HTTP ,Stateless – Server contains no Client State, Client-Server – How Representational are transfer between Client Server ? ,Cacheable – Cacheable Implicitly, Explicitly or Negotiated ,Layered System – Client can’t assume direct connection to Server, Code on Demand – Java Applets, Java Scripts)”