SDET Unicorns

What are REST APIs?

Table of Content

REST stands for Representational State Transfer. It is a software architectural style that defines a set of constraints or rules that you should adhere to when you are creating your APIs.

What about RESTful APIs? Well, when the APIs are conformed to these constraints, they are called RESTful APIs.

REST sets up a standard that makes it easier to use those APIs and anyone (ex: developer) familiar with these standards can quickly start using these APIs.

Let’s go over some of these architectural constraints:

  1. Client-Server separation: Client (let’s say your browser) and server shouldn’t depend on each other, they should act independently and communication should only happen using request which the only Client should be able to make. The server shouldn’t send the client information which hasn’t even been requested. So basically the main principle behind this is having the separation of concerns between the Client and the Server.
  2. Uniform interface: Client and Server should provide all the necessary info to each other so both can act upon the data accordingly, for example – request should contain resource identifier i.e the endpoint when making a request. There are also some other constraints for this, you can read more about it here
  3. Statelessness – The server should not store any info about the user using that API. So every time a request is made by the client, it will need to contain all the info required for the server to provide you with a proper response. Even if the request is made 100 times server wouldn’t remember that so its the client’s responsibility to send all the relevant data to the server
  4. Cacheability – Response provided by the server is cacheable or not (usually checked by version number)
  5. Layered System – there could be many other layers (proxy or load-balancer) between client and servers but it shouldn’t affect the request or response in any way
  6. Code on demand – Optional constraint, the server can provide executable code (scripts) to the client on demand

If you are interested, you can read more about these constraints here


With REST most commonly used means of communication is via HTTP. Let’s take a look at what the HTTP Request looks like –

  • Base URI: this is where you are making the request from. ex: https://jsonplaceholder.typicode.com/todos/1
  • HTTP Methods: what operation you are performing (GET, POST etc..)
  • Headers: additional information passed to the client and server (ex: authentication, content-type etc..)
  • Body: optional data/body to provide with the request

We covered HTTP methods briefly above, let’s go over them a little bit more. REST HTTP Methods follow CRUD operations and it maps the following way:

  • POST (Create) – creates a new resource (adds a new entry in the database)
  • GET (Read) – most commonly used to fetch/retrieve data
  • PUT/PATCH (Update) – used to update a resource (edits an existing entry in the database)
  • DELETE (Delete) – delete a resource from the server (delete the entry from the database)

Check out the video below to see a real API example to better understand the above topics


To learn more about API testing, check out my free tutorial series here –

JavaScript API Automation Testing Tutorial Series

My Resources

Thrive Suite: The all-in-one WordPress theme I used to create my blog.
Jasper AI: My favorite AI writing tool.
Surfer SEO:  A tool to help you rank your content on the first page of Google.

Write Content Faster

5/5

Write blog posts that rank for affiliate terms!

Join our mailing list

Unlock the Secrets to Becoming a SDET Pro in the Industry!

Stay ahead of the curve! Join our mailing list for exclusive insights, tips, and the latest industry updates delivered straight to your inbox

Table of Content

Related Post

7 Principles of Software Testing

7 Principles of Software Testing with Examples

Software testing plays a crucial role in the software development life cycle as it helps ensure the quality, reliability, and performance of the final product. Software testing is not just about finding defects; it also provides valuable insights into the overall quality of the software. By conducting effective software testing, it shows how well the application behaves in different scenarios and whether it meets user expectations.

Read More »
Differences Between CI/CD and DevOps

Key Differences Between CI/CD and DevOps

Software development is far from a simple journey that involves merely executing code and launching applications. It often presents challenges, as it’s rare to get everything right from the start. Each time you implement new or frequent code changes, you inadvertently introduce potential issues that can be time-consuming to resolve. This complexity necessitates a structured approach to ensure smooth production.

Read More »