Interview Questions OF REST (Representational state transfer)
What
is REST?
Representational state transfer (REST) is an
abstraction of architecture of World Wide Web. REST is an architectural style
to design networked application. REST makes communication between remote
computers easy by using the simple HTTP protocol which support for CRUD
(Create, Read, Update, and Delete) operations on the server.
2.
The commonly used HTTP methods used in REST based architecture?
GET
− Provides a read only access to a resource.
PUT
− Used to create a new resource.
DELETE
− Used to remove a resource.
POST
− Used to update an existing resource or create a new resource.
OPTIONS
− Used to get the supported operations on a resource.
3.Resource
in REST?
REST architecture treats every content as a
resource. These resources can be text files, html pages, images, videos or
dynamic business data. REST Server simply provides access to resources and REST
client accesses and modifies the resources. Here each resource is identified by
URIs/ global IDs.
4.Best
practices to design a resource representation?
Following are important points to be considered
while designing a representation format of a resource in a RESTful web services
−
Understandability
− Both Server and Client should be able to understand and utilize the representation
format of the resource.
Completeness
− Format should be able to represent a resource completely. For example, a
resource can contain another resource. Format should be able to represent
simple as well as complex structures of resources.
Linkablity
− A resource can have a linkage to another resource, a format should be able to
handles such situations.
5.The
core components of a HTTP Request and HTTP Response?
There are 5 major components for HTTP Request.
Verb − Indicate HTTP methods such as GET, POST,
DELETE, PUT etc.
URI − Uniform Resource Identifier (URI) to identify
the resource on server.
HTTP Version − Indicate HTTP version, for example
HTTP v1.1 .
Request Header − Contains metadata for the HTTP
Request message as key-value pairs. For example, client ( or browser) type,
format supported by client, format of message body, cache settings etc.
Request Body − Message content or Resource
representation.
6. There are 4 major components for HTTP Response.
Status/Response Code − Indicate Server status for
the requested resource. For example 404 means resource not found and 200 means
response is ok.
HTTP Version − Indicate HTTP version, for example
HTTP v1.1.
Response Header − Contains metadata for the HTTP
Response message as key-value pairs. For example, content length, content type,
response date, server type etc.
Response Body − Response message content or Resource
representation.
7.
Messaging in RESTful webservices?
A client sends a message in form of a HTTP Request
and server responds in form of a HTTP Response. This technique is termed as
Messaging. These messages contain message data and metadata i.e. information
about message itself.
8.
The core components of a HTTP Request?
A HTTP Request has five major parts −
Verb
− Indicate HTTP methods such as GET, POST, DELETE, PUT etc.
URI
−
Uniform Resource Identifier (URI) to identify the resource on server.
HTTP
Version − Indicate HTTP version, for example HTTP v1.1.
Request
Header − Contains metadata for the HTTP Request message as
key-value pairs. For example, client (or browser) type, format supported by
client, format of message body, cache settings etc.
Request
Body
− Message content or Resource representation.
9.
Statelessness in RESTful Webservices?
The communication between client and server must be
stateless. This means that each request from a service consumer should contain
all the necessary information for the service to understand the meaning of the
request, and all session state data should then be returned to the service
consumer at the end of each request
10.
The advantages and
disadvantages of statelessness in RESTful Webservices?
Advantages:
Web services can treat each method request
independently.
Web services need not to maintain client’s previous
interactions. It simplifies application design.
As HTTP is itself a statelessness protocol, RESTful
Web services work seamlessly with HTTP protocol
Disadvantages:
Web services need to get extra information in each
request and then interpret to get the client’s state in case client
interactions are to be taken care of.
Interview Questions OF REST (Representational state transfer)
Reviewed by NEERAJ SRIVASTAVA
on
12:15:00 PM
Rating:
No comments: