3 ms·
> Many of the APIs of projects I've worked with look like essentially like RPC style calls. There are two correct responses to this: - Use a decent RPC framew
by morelisp 4y ago
> Many of the APIs of projects I've worked with look like essentially like RPC style calls.
There are two correct responses to this:
- Use a decent RPC framework to hide HTTP's semantics (which are not appropriate for RPC) and to get generally better but still widely-accessible tooling; I use gRPC but at this point there are a dozen good-enough ones (JSON-RPC not being among them).
- Design a REST, or at least REST-ish, API. Map your URLs to entities not actions or methods. Make each entity have a canonical URL. Use content negotiation. And so on. It's more work but you're also available to a lot more real HTTP clients.
There is also a wrong answer:
- Continue trying to do RPC over HTTP semantics with an inefficient format and assume that having a standards document per se solves literally any problem.