4 ms·
Ask HN: Why don't people just stick to something universal for APIs?
Am I the only one that gets annoyed by varying methods used to contact API servers (XML-RPC, SOAP, REST...), not to mention that the output is usually in XML or JSON?
What's wrong with having RESTful APIs, have all the API examples/demos use cURL (I've yet to find a case where a cURL lacks a function for HTTP[s] requests) and finally have all the output in JSON?
Now this might be an unpopular opinion so feel free to shower me in downvotes.
- craigcabrey 10y agoBecause having a one size fits all mindset is a narrow view to hold. Use cases should drive engineering decisions, not a grand vision of the world in someone's head.
- byoung2 10y agoI think the current trend is a rest api with json input/output, and an sdk in the popular languages that wraps the api.
- bikamonki 10y agoSimple: existing infrastructure. Just as phasing out petrol-powered vehicles will take decades, so it takes years to move IT infra to the new standards. Add to it this complexity: new ways to solve IT problems arise all the time. Just as now it seems that REST + JSON are the best possible solution, SOAP + XML had the same status a few years back. What will happen when browsers run byte code? Or when we descentralize internet services?
- VertexRed 10y agoBut RESTful APIs have been around for so long though, does this the existing infrastructure situation really apply to this?
- mattkrea 10y agoOf course it does. Every day I still deal with services that speak on a schedule with SFTP and flat files.. existing infrastructure is hard to eradicate.
- throwaway420 10y agoI think we've all been there before...wouldn't it be nice if there was one standard way of doing something? Yes and no. Sure, it might make things easier most of the time. But a one-size-fits-all approach might also lead to limited innovation and experimentation.
- VertexRed 10y agoThat's usually the case, but I can't really come up with anything as I can't find any downsides to it.
- niftich 10y agoThey do stick to trends. The problem is, trends change over time. Back in the early 2000s, SOAP was The Orthodox Way lest you got shunned. In the early 2010s it was HTTP-based templated URLs, JSON payloads usually served as "application/json" documented out-of-band, secured with OAuth 2.0 increasingly in favor of other methods. The future is undecided, but new RPC frameworks are being embraced (RPC is no longer a dirty word) [1], and some people are even re-inventing the idea of passing an actual query written in a query language from client to server [2]. So, in short, new ideas come along; sometimes new ideas are a re-imagining (or lessons learned) of old ideas. Factors involved in engineering trade-offs change; and finally, some of it is simply fashion. [1] http://www.grpc.io/ http://www.grpc.io/ [2] http://graphql.org/ http://graphql.org/
- eip 10y agoREST and JSON are inefficient and irritating to work with. Websocket with binary protocol like protobuf is much nicer. Even SOAP was much nicer because you could usually code generate a client from a WSDL.