Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Define Messaging in terms of RESTful web services.

Answer»

The technique of SENDING a message from the REST client to the REST server in the form of an HTTP request and the server responding BACK with the RESPONSE as HTTP Response is called Messaging. The messages contained constitute the DATA and the METADATA about the message.

2.

Can you tell the disadvantages of RESTful web services?

Answer»

The disadvantages are:

  • As the services follow the idea of statelessness, it is not possible to maintain sessions. (Session SIMULATION responsibility lies on the client-side to pass the session id)
  • REST does not impose security restrictions inherently. It inherits the security measures of the PROTOCOLS implementing it. Hence, care MUST be chosen to IMPLEMENT security measures LIKE integrating SSL/TLS based authentications, etc.
3.

What are the HTTP Methods?

Answer»

HTTP METHODS are also KNOWN as HTTP Verbs. They form a major PORTION of uniform interface restriction followed by the REST that SPECIFIES what action has to be followed to get the requested resource. Below are some examples of HTTP Methods:

  • GET: This is used for fetching details from the server and is basically a read-only operation.
  • POST: This method is used for the creation of new resources on the server.
  • PUT: This method is used to update the old/existing resource on the server or to replace the resource.
  • DELETE: This method is used to delete the resource on the server.
  • PATCH: This is used for modifying the resource on the server.
  • OPTIONS: This fetches the list of supported options of resources present on the server.

The POST, GET, PUT, DELETE corresponds to the create, read, update, delete operations which are most commonly called CRUD Operations.

GET, HEAD, OPTIONS are safe and idempotent methods WHEREAS PUT and DELETE methods are only idempotent. POST and PATCH methods are neither safe nor idempotent.

4.

What are HTTP Status codes?

Answer»

These are the standard codes that refer to the predefined status of the task at the server. Following are the status codes formats available:

  • 1xx - represents informational responses
  • 2xx - represents successful responses
  • 3xx - represents redirects
  • 4xx - represents client errors
  • 5xx - represents server errors

Most commonly used status codes are:

  • 200 - success/OK
  • 201 - CREATED - used in POST or PUT methods.
  • 304 - NOT MODIFIED - used in conditional GET requests to reduce the bandwidth use of the network. Here, the body of the response sent should be empty.
  • 400 - BAD REQUEST - This can be due to validation errors or MISSING input data.
  • 401- UNAUTHORIZED - This is returned when there is no valid AUTHENTICATION credentials sent along with the request.
  • 403 - FORBIDDEN - sent when the user does not have access (or is forbidden) to the resource.
  • 404 - NOT FOUND - Resource method is not available.
  • 500 - INTERNAL SERVER ERROR - server threw some exceptions while running the method.
  • 502 - BAD GATEWAY - Server was not able to get the response from another upstream server.
5.

What do you understand by JAX-RS?

Answer»

As the name itself stands (JAX-RS= JAVA API for RESTful Web SERVICES) is a Java-based specification defined by JEE for the implementation of RESTful services. The JAX-RS library makes usage of annotations from Java 5 onwards to simplify the process of web services development. The LATEST version is 3.0 which was released in JUNE 2020. This specification also PROVIDES necessary support to create REST clients.

6.

What is the concept of statelessness in REST?

Answer»

The REST architecture is designed in such a way that the client STATE is not maintained on the server. This is KNOWN as statelessness. The context is provided by the client to the server USING which the server processes the client’s request. The SESSION on the server is identified by the session IDENTIFIER sent by the client.

7.

What are the features of RESTful Web Services?

Answer»

Every RESTful web service has the following features:

  • The service is based on the CLIENT-Server model.
  • The service uses HTTP Protocol for fetching data/resources, query execution, or any other functions.
  • The medium of communication between the client and server is called “Messaging”.
  • Resources are accessible to the service by means of URIs.
  • It follows the statelessness CONCEPT where the client request and response are not dependent on others and thereby provides TOTAL assurance of GETTING the required data.
  • These SERVICES also use the concept of caching to minimize the server calls for the same type of repeated requests.
  • These services can also use SOAP services as implementation protocol to REST architectural pattern.
8.

What is URI?

Answer»

Uniform Resource Identifier is the full form of URI which is used for identifying each resource of the REST architecture. URI is of the format:

<PROTOCOL>://<service-name>/<ResourceType>/<ResourceID>

There are 2 TYPES of URI:

  • URN: Uniform Resource Name identifies the resource by means of a name that is both unique and persistent.
    • URN doesn’t always specify where to locate the resource on the internet. They are used as templates that are used by other parsers to identify the resource.
    • These FOLLOW the urn SCHEME and usually prefixed with urn:. Examples include
      • urn:isbn:1234567890 is used for identification of book based on the ISBN number in a library application.
      • urn:mpeg:mpeg7:schema:2001 is the default namespace rules for metadata of MPEG-7 video.
    • Whenever a URN identifies a document, they are easily translated into a URL by using “resolver” after which the document can be downloaded.
  • URL: Uniform Resource LOCATOR has the information regarding fetching of a resource from its location.
    • Examples include:
      • http://abc.com/samplePage.html
      • ftp://sampleServer.com/sampleFile.zip
      • file:///home/interviewbit/sampleFile.txt
    • URLs start with a protocol (like ftp, http etc) and they have the information of the network hostname (sampleServer.com) and the path to the document(/samplePage.html). It can also have query parameters.
9.

What is a REST Resource?

Answer»

Every content in the REST architecture is considered a RESOURCE. The resource is analogous to the object in the object-oriented programming world. They can either be represented as text files, HTML pages, images, or any other dynamic data.

  • The REST SERVER provides access to these resources whereas the REST client consumes (accesses and modifies) these resources. Every resource is identified GLOBALLY by means of a URI.
10.

What do you understand by RESTful Web Services?

Answer»

RESTful web services are services that follow REST architecture. REST STANDS for Representational State Transfer and uses HTTP protocol (web protocol) for IMPLEMENTATION. These services are lightweight, provide maintainability, scalability, support communication among multiple APPLICATIONS that are developed using different programming languages. They provide means of accessing resources present at server required for the client via the web browser by means of REQUEST headers, request body, response body, status CODES, etc.