Hacker News new | ask | show | jobs
by tomp 658 days ago
If you're picking communication protocols for your API endpoints, you're doing it wrong.

The ideal API supports `/api/call.json` and `/api/call.csv` and `/api/call.arrow` as well as `/api/call.grpc`, and the only thing that differs between these is the serializer (which is standardized and very well tested).

If the App is buggy, I want to (1) check what API calls it's making (2) be able to run those API calls myself, which is why I (ideally) need a text-based (human-readable) format.

1 comments

I need to do some realtime stuff which involves some kind of realtime updates of some sort, I guess I can call `/api/call.sock` and it'll just work?

Oh, I'm also supporting streaming. Will `/api/call.rtmp` work for me?

What's worse, I even allow voice chat and video calls! I guess I can just do `/api/call.webrtc`?

I also forget that I serve a lot of P2P traffic, so I guess I can just add `api/call.udp` too.

The problem I have now is, how do I serve this over HTTPS? I can't pick the protocol because that'd be doing it wrong. Do I serve extra APIs like `call.rtmps`, `call.webrtcs`, `call.udps`?

I haven't even told you how fucking awkward it is to constantly enter my login details to work with my git repository and `github.com/my/repo.ssh` just gives me a 404.

APIs are a lot more than just content negotiation; the protocol is a necessary part of it and it just so happens with the web (not the internet) that the protocol is HTTP(S) over TCP and advances in technology have continued to stress its utility.