Can we say “If an API is following 6 constraints of REST then it’s a RESTful API”?

Viewed 186

Can we say “If an API is following 6 constraints of REST then it’s a RESTful API”? or my statement is completely wrong?

3 Answers

Can we say “If an API is following 6 constraints of REST then it’s a RESTful API”? or my statement is completely wrong?

You probably need to be detailed about the nature of the "uniform interface" constraint:

REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state.

See also REST APIs Must be Hypertext Driven (Fielding 2008).

REST defines 6 architectural constraints which make any web service – a true RESTful API.

  1. Uniform interface
  2. Client-server
  3. Stateless
  4. Cacheable
  5. Layered system
  6. Code on demand (optional)

All the above constraints help you build a truly RESTful API, and you should follow them. Still, at times, If you find yourself violating one or two constraints. Do not worry; you are still making a RESTful API – but not “truly RESTful.”

Related