What is RESTful API

DaisyFighting
3 min readJul 19, 2021

A REST API is also known as RESTful API. REST stands for representation state transfer. It is an architectural pattern for creating web services. A RESTful service is one that implements that pattern.

Guiding principles of REST:

1: client-server: separating the user interface from the data storage, improve scalability

2: stateless: each request from the client to server must contain all of the information necessary to understand the request, session state is therefore kept entirely on the client. It cannot take advantage of any store context on the server. Managing the state of conversation is the complete responsibility of the client itself. The server does not help you with this.

Stateless means that every HTTP request happens in complete isolation. The server never relies on the information from previous requests.

  • REST is stateless, therefore the SERVER has no state (or session data)

3: Cacheable: if a response is cacheable, then a client cache is given the right to reuse that response data for later

4: uniform interface: 4 interface constraints: identification of resources; manipulation of resources through representation; self-descriptive message; and, hypermedia as the engine of application state.

5: layered system: an architecture to be composed of hierarchical layers by constraining component behaviour

6: Code on demand:

Difference between RESTful API & SOAP

SOAP: two computers communicates by sharing XML document. it is slower than REST. it turns on HTTP but envelops the message.
SOAP — Simple Object Access Protocol. REST -REpresentational State Transfer — is an architectural style that makes use of existing and widely adopted technologies, specifically HTTP, and does not create any new standards.

SOAP and REST — both provide support for building SOA based applications. The choice which one to use — largely depends on what really is required, from the business and an architectural point of view.

Interview Questions:

1) Explain what is REST and RESTFUL?

REST represents REpresentational State Transfer; it is a relatively new aspect of writing web API.

RESTFUL is referred for web services written by applying REST architectural concept are called RESTful services, it focuses on system resources and how state of resource should be transported over HTTP protocol to different clients written in different language. In RESTFUL web service HTTP methods like GET, POST, PUT and DELETE can be used to perform CRUD operations.

2) Explain the architectural style for creating web API?

The architectural style for creating web api are

  • HTTP for client server communication
  • XML/JSON as formatting language
  • Simple URI as the address for the services
  • Stateless communication

3) what are resources in a REST architecture?

Every content in the REST architecture is considered a resource. Resources are identified by logical URLs; it is the key element of a RESTful design. you view the product data as a resource and this resource should contain all the required information.

4) what is URI

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

5) What makes REST services to be easily scalable?

REST services follow the concept of statelessness which essentially means no storing of any data across the requests on the server. This makes it easier to scale horizontally because the servers need not communicate much with each other while serving requests.

--

--