Data API Questions
Our recent post about Relay and REST raised some interesting questions.
Bickering about REST aside, doesn’t Relay solve some real problems?
Yes. But Facebook set up REST as a strawman. There’s enough confusion about REST already without adding to it.
But aren’t data-oriented APIs like Relay and GraphQL at odds with REST?
We don’t believe so.
Okay, but what about cache invalidation? You don’t address that.
We haven’t addressed a lot of potential issues with REST-based data APIs. The point isn’t that we have all the answers. Or even that REST has all the answers. The point is that it doesn’t appear that the developer community is really trying very hard to find them. We’d like to see more work that builds upon the infrastructure that the Web already provides.
Cache invalidation is a great example. It’s an orthogonal concern to HTTP and REST, by definition. (Since HTTP is a protocol and REST is a set of architectural constraints.) But an HTTP REST data API library that also addressed cache invalidation would have been (and would still be) really useful.
Why does it matter so much that it’s REST?
Because REST over HTTP is how you create more Web. We are better off working together to improve the Web we have, than starting over with what amount to proprietary alternatives.