HeadlinesBriefing favicon HeadlinesBriefing.com

What it means for an API to be RESTful

Hacker News •
×

Many developers misunderstand what a RESTful API truly is. REST (Representational State Transfer) is an architectural style, not merely an HTTP interface. Defined by Roy Fielding in 2000, it imposes constraints such as client-server separation, statelessness, cacheability, layered systems, and a uniform interface. The term "RESTful" simply means conforming to REST principles.

Popular usage has diluted "REST" to mean any "HTTP API that returns JSON." Fielding himself criticized this in 2008, noting that many APIs only reach level 2 of the Richardson Maturity Model, which involves proper use of HTTP verbs and status codes. True RESTful APIs, at level 3, incorporate hypermedia, specifically HATEOAS (Hypermedia as the Engine of Application State).

HATEOAS allows clients to discover resources dynamically through links embedded in responses, similar to browsing the internet. This makes APIs self-descriptive and navigable. For instance, a user resource might include links to its update, delete, or associated posts. This approach decouples the client from fixed route structures, allowing backend changes without breaking client functionality. While conventions like HAL are common, the core principle is