REST API — Interview Preparation

Source: Seobility

is commonly known that many programming interviews may include questions related to APIs, and most probably REST API. So this article aims to give you five possible questions and answers to expect at an interview. Enjoy! :)

1.What is the REST API?

In short, REST stands for Representational State Transfer. This is a set of guidelines to use when developing a web service. Those services that comply with these guidelines are called RESTful services. There are six main principles of a REST architecture:

  • There is a division between client and server
  • REST API is stateless
  • It is cacheable
  • The interface is uniform
  • The system is hierarchically layered
  • Optional: code on demand

2. What are the differences between REST and SOAP?

SOAP stands for Simple Object Access Protocol. Key differences:

  • While SOAP is a protocol, REST is rather an architectural pattern.
  • SOAP requires more bandwidth than REST.
  • SOAP is compatible with XML, while REST can work with text, XML, HTML, and JSON.
  • SOAP cannot usee REST, while REST can use SOAP.
  • SOAP cannot be cached, while REST can.

There are also other minor differences, but these should be enough to note.

3. What are the benefits of REST API?

First of all, as the client and the server are clearly separated, it becomes easier to scale the application up and add new functionality. Furthermore, portability to other platforms is also improved by this.

Secondly, the separation mentioned above makes the application more reliable and the possibility to easily scale. This advantage also concern the independence of API. It is independent and can work on any platform. For example, you can use Python, PHP, Java and other servers.

4. Name some of REST API security threats

  • Injection attacks
  • DoS attacks
  • Broken authentication
  • Sensitive data exposure
  • Broken access control, etc.

5. What is a “Resource” in RESTful web services?

Anything that can be named. Example: document, image, virtual object, etc. Resource identifier is used to name a particular resource. Resources also have resource representations. This is data, metadata and hypermedia links associated with a resource at a given time.

These are some of the basic questions that you can expect. This topic can be extended to cover request types, security details and other relevant sections.

Data Scientist & Machine Learning Engineer @ The International Bank of Azerbaijan