REST Request

Representational state transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. It is a simple, standardized method of communication between web clients and servers. The main building blocks of the REST API are the request and the response.


Constraints of REST

1. Stateless – Server contains no client stage. However, the client side holds the session state. Each request contains enough contexts to process the message.

2. Uniform Interface – Interface between client and server, HTTP verbs (GET, PUT, POST, DELETE), URLs (resource name), and HTTP response (status, body).

3. Cacheable – Server responses (representations) are cacheable, implicit, explicit, and negotiable.

4. Layered System – It improves scalability. Usually, the client never informs if it is directly connected to the end server. Intermediary servers may enable load-balancing and provide shared caches to improve system scalability.

5. Client – Server – Clients from Servers are separated by UI. This separation of concerns means clients are least concerned about the activities at server end, like data storage, etc.




RESTful web services are standardized. A client requests server resources using HTTP methods – usually, GET, POST, PUT and DELETE.


1. GET. Extracts data from a server

2. POST. Creates new data on a server

3. PUT. Updates existing data on a server

4. DELETE. Deletes resources from a server


The server response could be JSON, images, HTML, or audio files stored at a given URL. In REST, URLs are called resources, while the data sent to you is a response.

When you browse a website, the web server would probably use a REST API to request data from a database server. Then, the website formats the data and feeds it to you.


The Anatomy of a Request, lets see with an example,


URL:https://www.google.com/search?q=houston+to+carsoncity+3+business+class+nonstopn+flight&oq=houston+to+carsoncity+3+business+class+nonstopn+flight&aqs=chrome..69i57j33i10i160l2.27776j1j9&sourceid=chrome&ie=UTF-8

Base Path: The base path is nothing but a starting point of the API you’re requesting from.

From the above example “ https://www.google.com/ “ is the base path.


Endpoint: The endpoint refers to the end path of the endpoint. It appears after the base path and ends with a question mark.

From the above example “/search? “ is the end path.


Query string: Query string parameters appear after a question mark (?) in the endpoint. The question mark followed by the parameters and their values is referred to as the “query string.” In the query string, each parameter is listed one right after the other with an ampersand (&) separating them. The order of the query string parameters does not matter.

From the above example “q=houston+to+carsoncity+3+business+class+nonstopn+flight&oq=houston+to+carsoncity+3+business+class+nonstopn+flight&aqs=chrome..69i57j33i10i160l2.27776j1j9&sourceid=chrome&ie=UTF-8 “ is the query parameter.









10 views0 comments

Recent Posts

See All