jsonapi-vs-graphql
https://dri.es/headless-cms-rest-vs-jsonapi-vs-graphql
Result:
we rank JSON:API above GraphQL and GraphQL above REST.
Compare:
- Request efficiency
-
REST
Poor; multiple requests are needed to satisfy common needs. Responses are bloated.
-
JSON:API
Excellent; a single request is usually sufficient for most needs. Responses can be tailored to return only what is required.
-
GraphQL
Excellent; a single request is usually sufficient for most needs. Responses only include exactly what was requested.
- Documentation, API explorability and schema
-
REST
Poor; no schema, not explorable.
-
JSON:API
Acceptable; generic schema only; links and error messages are self-documenting.
-
GraphQL
Excellent; precise schema; excellent tooling for exploration and documentation.
- Operational simplicity
-
REST
Acceptable; works out of the box with CDNs and reverse proxies; few to no client-side libraries required.
-
JSON:API
Excellent; works out of the box with CDNs and reverse proxies, no client-side libraries needed, but many are available and useful.
-
GraphQL
Poor; extra infrastructure is often necessary client side libraries are a practical necessity, specific patterns required to benefit from CDNs and browser caches.
- Writing data
-
REST
Acceptable; HTTP semantics give some guidance but how specifics left to each implementation, one write per request.
-
JSON:API
Excellent; how writes are handled is clearly defined by the spec, one write per request, but multiple writes is being added to the specification.
-
GraphQL
Poor; how writes are handled is left to each implementation and there are competing best practices, it's possible to execute multiple writes in a single request.
2019-04-17
Last modified at: Tue, 5 Jan 2021 12:31:39 +0000