Live data from Hacker News

An API is only as good as its documentation

rocketeer.be

21–30 of 59 posts

Re: An API is only as good as its documentation

#21

Any recommendations on good doc frameworks/products? We're about to begin redoing our documentation at print.io. Currently we're using swagger ( https://api.print.io/docs/ ) and "self-documentation" ( http://print.io/api ) but i still find that we have a lot of questions.

I find all of the auto-generated systems produce barely sufficient documentation.

Real documentation is written by a person who understands how to use the API.

Unfortunately, such documentation then suffers bit-rot if it's not updated whenever the API is updated.

What I would like to see is some way to describe an API which can be merged with the hand-written narrative and instructions, and can be refreshed whenever the implementation changes.

Re: An API is only as good as its documentation

#23
post #2

I have a corollary of sorts: A framework is only as good as its UI. This is a widely neglected point. Only game engines tend to understand this fully (e.g. Unreal Engine's editor). But Smalltalk and NextStep/Cocoa had a grasp of this too. Even without a GUI, the interface matters. Rails' "generate" and "console" commands are a major part of its appeal.

I find your comment about Rails facinating, as it teaches me a bit about how I'm a Blub programmer. I've tried to learn Rails multiple times and the "generate" and "console" commands have always been a massive stumbling block for me. With ever other language and toolkit I've ever worked with, the tutorial starts with opening up a text editor, writing some code, and producing a lousy, "Hello World" website. With Rails…

I don't think this is about being a Blub programmer. Rails is a complex web framework that is designed to help solve many common problems in web development. Therefore, it has tons of code organized in an arcane way you won't understand until you know what problems it's trying to solve.

That's why I always found teaching RoR (or equivalent frameworks in your language of choice) to beginners completely backwards. What the newcomer learns is how to tweak this huge blob of arcane magic here and there, and gains almost zero actual understanding of how things work. My preferred way of teaching webdev is showing how text goes from server to browser, how the browser parses it to render a page, and how a programming language is used to generate such text. And then I build up from this base. Sure, this approach won't make one a Rockstar Full-Stack Code Ninja in half a week, but at least the student has some solid foundation of understanding to work from and can comprehend why Rails looks the way it looks.

It also seems to me that the current trend in web development is people using huge complex tools, of which they need 1% and understand 0.1%, and thus generating layers upon layers of bloat. But my opinion here is probably biased as I hate webdev more and more with every single day I spend working in it.

Re: An API is only as good as its documentation

#25
The irony of this statement

"At Ticketmatic, we promise that anything you can do through the user interface is also available via the API."

in the context of the article is amusing. Going to the website, I find no mention of an API anywhere. I can only guess that it's API documentation hidden behind a login. This is the worst kind of API documentation. I've dealt with APIs like this far too often to find it friendly. In every case, it's been frustration.

Regardless, while the platitude is agreeable, this is literally an article that says nothing more than what fit into a tweet.

Re: An API is only as good as its documentation

#26
I'd rather say an API is only as good as the clients/libraries for it.

Having an API is nice, documenting it is nice, but this is not what developers are going to use.

If you only publish API documentation, you will end up with tons of half-baked, soon-to-be-unsupported, incompatible client libraries.

And until then, people will have to roll their own clients based on the documentation, which is not fun. Nobody wants to reinvent a REST client, deal with errors, timeouts, data conversion and how to match the API with actual use cases.

Especially when evaluating a new service, the last thing you want is have to read an API documentation before being able to do anything with the service.

Take MySQL. The protocol is all binary, and mostly undocumented. Yet, it's used everywhere because the MySQL maintainers are shipping a C library on top on which people built bindings.

Same for MongoDB. Even though there are alternative/additional client libraries, they are maintaining client libraries for many languages. Getting started with MongoDB is easy; one doesn't have to read an API documentation at all.

What if changes have to be made to the API? If the same team maintains the reference client libraries, it can be totally transparent to users. If you expect people to write their own client, it will be painful.

Please provide good reference client libraries so that people can immediately use the service, even before thinking about API documentation. And writing client libraries is also a good way to realize what's broken/inconvenient in the API.

Re: An API is only as good as its documentation

#27
It all depends on what kind of API you're building. If you're implementing a RESTful API, no documentation is needed, as it is "surfable" due to the use of hyperlinks. If you're implemeting an RPC API (which is what most of us are doing), good and up-to-date documentation is key, as we need to document each and every meaningful end-point.

Re: An API is only as good as its documentation

#28

The irony of this statement "At Ticketmatic, we promise that anything you can do through the user interface is also available via the API." in the context of the article is amusing. Going to the website, I find no mention of an API anywhere. I can only guess that it's API documentation hidden behind a login. This is the worst kind of API documentation. I've dealt with APIs like this far too often to find it friendly.…

Had to do a little searching, but here it is:

https://app.ticketmatic.com/api/doc

Re: An API is only as good as its documentation

#29

The irony of this statement "At Ticketmatic, we promise that anything you can do through the user interface is also available via the API." in the context of the article is amusing. Going to the website, I find no mention of an API anywhere. I can only guess that it's API documentation hidden behind a login. This is the worst kind of API documentation. I've dealt with APIs like this far too often to find it friendly.…

Had to do a little searching, but here it is: https://app.ticketmatic.com/api/doc

(Author here)

Nope, that's the old one for V2 (which isn't very good).

We're currently releasing the third generation of the Ticketmatic platform, where one of the big efforts is in improving the developer story.

That's not public yet, for which I apologise. There will be a beautiful developer program soon.

I didn't think that the article should wait on that. It's the idea that matters and didn't want any discussion to turn into a nitpicking over what we did right (and wrong).

This article mostly came out of a frustration with bad API documentation and I was hoping to inspire people to do (slightly) better.

Re: An API is only as good as its documentation

#30
Good documentation includes examples.

Good documentation does not rely on examples.

An example can provide a base to start from, a beginning point from which further hacking can ensue.

However, an example, like a picture, can't say "ain't": Examples can only show you what you can do, never what you cannot do, or what you should not do.

Further, examples are inductive, and it takes a massive amount of induction to get all of the rules of a system. However, once someone's done something, they've internalized it a lot better than if they've only read about it.

Examples should, therefore, allow people to see the intended use of an API. How do the developers want people to use their API to solve problems?

Documentation is permissive: "You can use this tool to do this."

Examples are normative: "You should use this tool this way."

Both are needed. I focus on examples because good examples are not as common as they should be.

Post reply on HN