REST API Interview Questions

1. What are Web Services and Web APIs and state their difference?

Web services are a type of API, which must be accessed through a network connection. Web service is used for REST, SOAP, and XML-RPC for communication.


Web APIs are application interfaces, implying that one application can communicate with another application in a standardized manner.


2. What is REST API?

REST is a web standards-based architecture and uses HTTP Protocol for data communication. It revolves around resources where every component is a resource and a resource is accessed by a common interface using HTTP standard methods.


3. What are REST operations?

That data can be used to GET, PUT, POST, and DELETE data types, which refers to the reading, updating, creating, and deleting operations concerning resources.


4. What do we mean by REST is stateless?

REST APIs are stateless because, rather than relying on the server to remember previous requests, REST applications require each request to contain all of the information necessary for the server to understand it. Storing session state on the server violates the REST architecture’s stateless requirement.

5. What are HTTP status codes and their group?

  • Informational responses ( 100–199 )
  • Successful responses ( 200–299 )
  • Redirection messages ( 300–399 )
  • Client error responses ( 400–499 )
  • Server error responses ( 500–599 )

6. What are the parts of HTTP requests? What are HTTP methods?

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value.


The primary or most commonly-used HTTP methods are POST, GET, PUT, PATCH, and DELETE. These methods correspond to create, read, update, and delete (or CRUD) operations, respectively.


7. What is the use of Head in the HTTP method?

HEAD is a request method supported by HTTP used by the WWW. The HEAD method asks for a response identical to that of a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.


8. What are the parts of HTTP request and response?

An HTTP request is divided into three parts: Request line, header, and body. An HTTP response is also divided into three parts: Status line, header, and body.


9. What is the difference between Content-type and Content-disposition?

The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied for sending).


Content-Disposition response header is a header indicating if the content is expected to be displayed inline in the browser, that is, as a Web page or as part of a Web page, or as an attachment, that is downloaded and saved locally.