DEV Community

CodeWithVed
CodeWithVed

Posted on

2

How would you consider your API to be Restful?

Before answering that question lets see what is REST API?
A REST API (also known as RESTful API) is an application programming interface that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for Representational State Transfer and it was first introduced by Roy Fielding in the year 2000.

In REST API, the fundamental unit is a resource.
n order for an API to be considered RESTful, it has to conform to these architectural constraints:

  • Uniform Interface: There should be a uniform way of interacting with a given server.
  • Client-Server: A client-server architecture managed through HTTP.
  • Stateless: No client context shall be stored on the server between requests.
  • Cacheable: Every response should include whether the response is cacheable or not and for how much duration responses can be cached at the client-side.
  • Layered system: An application architecture needs to be composed of multiple layers.
  • Code on demand: Return executable code to support a part of your application. (optional)

Advantages of REST API

  • Simple and easy to understand.
  • Flexible and portable.
  • Good caching support.
  • Client and server are decoupled.

Disadvantages of REST API

  • Over-fetching of data.
  • Sometimes multiple round trips to the server are required.

Use cases:

REST APIs are pretty much used universally and are the default standard for designing APIs. Overall REST APIs are quite flexible and can fit almost all scenarios.

API Trace View

Struggling with slow API calls? 🕒

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay