DEV Community

Discussion on: Is GraphQL a REST API?

Collapse
 
alainvanhout profile image
Alain Van Hout

No I don't think you can consider GraphQL to be a kind of REST, since it doesn't follow the precepts of REST:

  • it doesn't use http verbs/methods in a semantic was
  • it doesn't supply different resources at different URLs
  • it doesn't use uniform interface for the URLs (i.e. that the path follows conventions like /users/:id)
  • it doesn't leverage (or even care about) media types (e.g. getting the same resource as JSON, XML, or something else entirely)

The only real overlap is that GraphQL typically uses http (though it doesn't really require that, conceptually) and a JSON-like syntax (just as actual JSON tends to be the preferred REST body syntax).