Is Your REST API really a REST API?
Before anything I want us to keep this name at the top of our heads, not forever but for now. LEONARD RICHARDSON . I know your question. Why? That's because he gave us a practical measure of some sorts to measure how "RESTful" your API actually is, the Richardson Maturity Model (RMM). Essentially, it's like a grading system for APIs. From RPC-over-HTTP (Level 0) to hypermedia (Level 3). So let's…
Leonard Richardson introduced the Richardson Maturity Model (RMM) to assess how RESTful an API is. The model grades APIs from Level 0 to Level 3, each representing a different degree of RESTful adherence.
Level 0 (The Swamp) is where an API uses a single endpoint for all actions, resembling RPC over HTTP. This lacks REST principles, making it hard to scale and prone to breakdowns.
Moving up to Level 1, APIs start identifying resources with URLs and use HTTP methods for actions, although actions are often overused. It's an improvement but still not fully RESTful.
Level 2 APIs correctly use REST verbs such as GET, POST, PUT, and DELETE. This is a solid foundation but still lacks hypermedia links.
Finally, Level 3 APIs embody true RESTfulness. They include hypermedia links (HATEOAS) in responses, allowing clients to follow links and discover possible actions. This makes APIs more flexible, adaptable, and self-describing, akin to navigating a website.
So, if your API reaches Level 3, you're on the right track. Even reaching Level 2 shows a good understanding of REST principles. However, the ultimate goal is to embrace true hypermedia, enabling truly resilient and adaptable APIs.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.