3 ms·
GraphQL will probably overtake REST in a few years time: https://trends.google.com/trends/explore?date=today%205-y&q=graphql,rest%20api https://trends.google.c
by nailer 9y ago
GraphQL will probably overtake REST in a few years time:
https://trends.google.com/trends/explore?date=today%205-y&q=graphql,rest%20api https://trends.google.com/trends/explore?date=today%205-y&q=...
If you were building a large scale API now, having duplicate data at each resource (eg, avatar icon URLs in /feed) or requiring users to cross reference multiple resources for a single simple task (eg GETing /users and /feed to draw a simple timeline with user avatars) is a hassle and there's no real reason to force yourself or your API consumers through it.
The GraphQL specification is here: https://facebook.github.io/graphql/ https://facebook.github.io/graphql/
- daliwali 9y agoNo one is stopping you from implementing a URL like: `/feed?include=users`, which is easier on the eyes than the GraphQL equivalent. But clients generally aren't aware of the `include` query or what it does unless it's advertised from the server. There's URI templates (RFC 6570) which let you advertise it as `/feed{?include}`, but few clients understand URI templates. With GraphQL, it's part of the spec, but you must know that the server follows the spec anyways.
- ruslan_talpa 9y agoThis is exactly what PostgREST is doing, it's interface has the same expressive power as GraphQL
- ahoka 9y agoWhat's the point of discoverability when consumers don't know the semantic meaning? Does it help if you discover that you can add an include query? That you can pass the value "user"? What is a user? Maybe you can look it up in Swagger. Is that still discoverable? What if it needs more than just common sense to understand the business language?
- daliwali 9y agoThat's what a vocabulary is for. schema.org[0] has something semantically equivalent to a user, a person. [0] http://schema.org/Person http://schema.org/Person