Ask HN: Is it time for a REST specification?
I understand REST isn't a standard, but an architecture style. But, I have been seeing a lot of badly implemented APIs which definitely won't follow the architecture, but still call themselves RESTful.
Here are the Google trends for REST APIs and REpresentational State Transfer:
https://trends.google.com/trends/explore?date=today%205-y&q=REST%20APIs
https://trends.google.com/trends/explore?date=today%205-y&q=%2Fm%2F03nsxd
These trends indicate that the interest in REST is growing over years, and very different definitions of REST from various sources is very confusing.
So, is it time for W3C to put out a spec for REST?
(
22 comments
| 17 points
| on HN
)
The ones that fall in the middle are harmful.
It just leads to a million kind-of-similar things but because there's insufficient similarity you can't reap the benefits of having the spec (think automated documentation tools, pluggable APIs, client/server tools, etc).
It turns into a religion and a word that everyone ends up using but hardly any two people agree on exactly what it is.
If there's a spec for something it should have a corresponding verification tool that takes your stuff as input and basically validates it down to a yes/no answer. Your API is either compliant or not end of story. It shouldn't be a shade of grey that leaves room for arguments and lengthy blog posts about the philosophy of the spec.
The spec can still accommodate and allow for some uncertainty and flexibility but in a controlled manner and while maintaining an unambiguous specification.
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/
[0] http://schema.org/Person
A formal spec will not fix the flawed notion that any/all protocol msgs can be mapped to what are essentially CRUD HTTP verbs, or that the underlying HTTP protocol was fundamentally designed for serving hypertext documents and accepting occasional form data.
That implies that you have a clear distinction between external and internal APIs that doesn't change over time. Lucky you.
All of them suffer from a chicken or egg problem. Without servers following specs, there won't be clients. Without spec-based clients, servers will continue to serve ad hoc formats.
Actually it is kind of a miracle that the web was standardized around HTML and not thousands of competing markup formats. We have JSON as a defacto standard for a machine format, but it lacks semantics, which is where JSON-LD comes into play.
I have not actually seen an API using JSON-LD in the wild, but it looks promising and is a W3C recommendation. The spec says nothing about building APIs and it looks kind of ugly with all of its @ prefixes, which is where Micro API[2] comes into play.
[0] http://stateless.co/hal_specification.html
[1] http://www.hydra-cg.com/
[2] http://micro-api.org/
[3] I did not include JSON API, since it does not make hypermedia a requirement.
You GET or POST data, parse a response. Details are somewhat immaterial since they're mostly just values for variables. I'd definitely love to see some standard format for documentation but a world where REST nazis tell me my API lacks lazyass engineer feature X (edit: within the context of a private API) would suck.
Perfect REST API's are a total waste of time when building stuff for internal consumption.
I mean REST has been successful so far so why change?
It just talks directly to AWS Lambda functions.
What a relief.... so quick to get things done, no pointless definition and specification and no longer any need to built yet another layer of abstraction into my application.
I'm not saying there isn't a place for REST and HTTP APIs but I'm just glad that for this project I have been able to avoid all that entirely. HUGE productivity boost.
My theory on software development is that any technology that can be replaced by something more simple will eventually disappear in favor of that alternative. REST falls into that category. The future looks more like GraphQL.
Sounds like a spec
Maybe that would be a good thing.