REST vs RESTful APIs: You're probably missing the third level.
Daniel Domingueti
Tech lead | Backend software engineer | Java | NodeJS | Fintechs
When discussing APIs, the terms "REST" and "RESTful" often surface. Let’s clarify the distinction and explore them.
What is REST?
REST (Representational State Transfer) is an architectural style for designing distributed systems, particularly web services. REST is based on a set of principles, including statelessness, resource identification through URIs, and uniform interfaces.
REST is no more than a guideline that informs how web services should be structured to maximize scalability and performance.
What is RESTful?
In essence, a RESTful API is one that adheres to the constraints of REST.
Leonard Richardson's Maturity Model breaks down RESTful APIs into four levels:
领英推荐
At the end of the day, a RESTful API is only fully REST-compliant if it meets all four levels.
Most APIs adheres to the first 3 levels. The question now is: Is it worth to implement the last one as well (HATEOAS)? When should I adopt it?
Upside of implementing HATEOAS in your RESTful API
Example: A GET /users/1 response includes:
{
"id": 1,
"name": "Daniel Domingueti",
"_links": {
"self": { "href": "/users/1" },
"update": { "href": "/users/1", "method": "PUT" },
"delete": { "href": "/users/1", "method": "DELETE" }
}
}
Downside of implementing HATEOAS in your RESTful API
Conclusion
REST is the foundation, but being RESTful requires thoughtful implementation of its principles.
While the benefits—like scalability, flexibility, and discoverability—are immense, the additional complexity must align with your project’s needs.