Ask HN: Why do companies typically provide APIs but not clients or specs?
Why don't more companies publish either a specification for their API or an API client on a website like GitHub?
For small shops with a few engineers, this makes sense, but for companies that we're paying > $100,000/yr. for access to their APIs, it seems like they should also provide an API client for interacting with it - or at the very least, API documentation.
What are the main barriers preventing more companies from releasing either a specification for their APIs or an API client?
Are APIs easier to reverse engineer these days, and therefore it's not really necessary to release a client or specification?
On the other hand, maybe writing a full-fledged API client is an anti-pattern, since callers could simply implement the functionality that they need rather than implementing all of the functionality that they think that they MIGHT need while still reverse engineering the API?
12 comments
[ 3.0 ms ] story [ 30.1 ms ] threadAs far as publishing a spec, I don't know but I'm guessing part of it is a reluctance to commit to anything (which does kind of defeat the purpose of a public API).
I know that you can send HTTP requests in every language - I was moreso referring to say, a Python package that you could import into your project and use off the shelf without having to write one yourself over the course of weeks to months as you become more familiar with the vendor's API.
I suppose that it makes sense that vendors tend to only provide APIs rather than API clients since one client may use say, Ruby rather than Python...
> for companies that we're paying > $100,000/yr. for access to their APIs
Case in point; they didn't need to provide any of that for you to pay. The value is coming from elsewhere, and they didn't think the extra upfront and ongoing cost of providing a client or docs is worth it.
I do agree that many companies can design and document their APIs better.
I did say they should document better. Customers shouldn't have to reverse engineer.
But you can't account for how all of your customers are going to use your API. It is the interface.
Like, you mentioned in another comment about a python package as an example of what they could offer. Should they offer Rust, Go, JS, etc., clients as well?
If you buy cement, you don't expect the seller to box in the area where it should be poured. They don't have the blueprints to do that correctly. They're not building your building. The trough on the cement truck is their interface. What you do with it is your job to figure out.
Something I haven't seen mentioned much on this thread is that the ~top feature people want from SDKs at this point is good static types – so you can get autocomplete, docs-on-hover, etc in your editor. Way better than switching back and forth to the docs and crossing your fingers.
Doing that well means copying every little change into the SDKs (forget about it) or using a generator.
The open-source codegen tools (ie, https://openapi-generator.tech/) are pretty crappy, so you need to either build the SDK yourself fully, or spend a bunch of time wrestling with the generator get it halfway-decent, and then you're still letting your customers/developers down.
Disclaimer, I'm starting a company to make it easy for anyone to ship a great SDK with their REST API: https://stainlessapi.com
e.g. a reference implementation in Ruby if they're a Ruby shop, a reference implementation in Java if they're a Java shop, etc.
I wonder if you can generate a "good enough" API client to start out with using say, OpenAPI and then tweak it to suit your needs?
Then again, maybe this is where something like gRPC would really shine compared to REST APIs - I'm not sure, but, it seems like an area that could be improved significantly.
Your startup sounds promising, and hopefully it helps to simplify things!
They tend to get quite sick of both hand-maintaining any SDK (even in the language they love), and of dealing with the problems/toil of the openapi generator (or the user complaints of the non-idiomatic code they didn't understand, because it was in a different language).
Still, it's better than nothing, so I applaud those who take on the effort!
Thanks for the kind words – we hope to help bring the well-typed nature of gRPC to REST, without making things more complicated.
Being API-first and caring about the developer experience (DX) is still a new phenomenon. Companies like Twilio and Stripe differentiated in DX. Now there's a whole category of API-first startups like seam.co (API for IoT devices), merge.dev (unified API for 180+ integrations), and stytch.com (API for authentication) who publish API clients in major languages like Node.js, Python, Java, and Go. They also publish their OpenAPI specs in case you use a long-tail language and want to generate a client yourself.
IMO, in the next 5 years, it'll become the norm to offer clients if you have a public REST API.