TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Best and Worst API Documentations?

25 点作者 shreythecray超过 2 年前
Really trying to improve my company's docs and I am looking for some examples of what to do and what not to do. It's really tough gaging how helpful or easy your own docs are so it would help to compare them to what other developers prefer.

21 条评论

kjellsbells超过 2 年前
Im not a pro hacker, but I occasionally have to consume an API. My personal golden rules are<p>- be meaningful. listWidget(str name): Returns a Widget is useless to me. 90% of api docs i see are like this, its evident they&#x27;ve been auto-generated and no effort had been made. Code samples help but really they are second order answers to the fundamental questions users have: why should I consume this function? How do I consume it? What should I expect? How to detect problems? And, hardest of all, when should I use something else?<p>- include an overview block at the start of every api definition, to orient the reader. What does this API do? What are the most important objects and calls? What limits and rules does the reader feed to know? Write at a lower reading level than you normally use to capture newbies and non native speakers.<p>- Meaningful code samples are great, but dont kid yourself. If the sample is unrealistic, particularly if you are eliding a difficulty that the real world practictioner is guaranteed to face, you are cheating yourself and them. Address it.<p>- make navigation easy. breadcrumbs, scroll to top, cross refs etc.<p>I&#x27;ve never found api docs that hit all of these, by the way.
评论 #32774310 未加载
MrWiffles超过 2 年前
Not sure if it&#x27;s quite what you&#x27;re after, or if it&#x27;s as good as it used to be, but php.net&#x27;s documentation was PHENOMENAL back in the day when I was just getting started (~20 years ago).<p>Worst: My god, look at Apple. Where&#x27;s the documentation on MacOS?!<p>EDIT: One thing I would suggest is to find a balance between skimmable documentation (nobody READS anymore, we don&#x27;t have time or patience for that) and explanation (extracted structure&#x2F;data types alone aren&#x27;t nearly enough). Also, code samples! Code samples all the way! These are very helpful particularly for people that don&#x27;t speak English as their native language. It&#x27;s one thing to skim some English documentation and not quite &quot;get it&quot;, but a code sample illustrating usage in a simple context can go much, much further.
评论 #32770562 未加载
kennydude超过 2 年前
Recently one of the worst I&#x27;ve seen is a property management system&#x27;s API:<p>* Bugs in the implementation<p>* JSON looks like auto-translated XML without an XML<p>* Nothing about data types, values for an enum you could expect<p>On the flipside, Stripe&#x27;s is one of the best. Although the only issue Ive seen is webhook signature code always uses their SDK which I don&#x27;t always want to use, and webhooks can&#x27;t be configured on a per-payment basis so if you have multiple systems on the same Stripe account, all of them get notified of everything (unlike other payment providers!)
superchroma超过 2 年前
I find myself consistently pleased with the quality and consistency of the MSDN documentation for C#. It usually has a nice example for just about everything that deserves one.<p>I used to like DotNetPerls because it made me pause and smile with its strange almost zen-like analogies, but now it&#x27;s gotten a lot more formal, which makes me a little sad.
评论 #32770351 未加载
ndimares超过 2 年前
I really like <a href="https:&#x2F;&#x2F;getstream.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;getstream.io&#x2F;</a> docs. For me, SDK support is important, as are examples and templates that I can play with &amp; build off of. I also like the API usage dashboard that Stream supplies when you login. Which veers into the terriory of dev portal, but worth mentioning.<p>Also, in terms of tools for actually building documentation, I recommend looking at <a href="https:&#x2F;&#x2F;docusaurus.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docusaurus.io&#x2F;</a> for clean, customisable documentation.
krnlpnc超过 2 年前
What not to do: host “self documenting” API docs which are only accessible from an API endpoint themself and contain zero context or examples, only terse names and descriptions.
评论 #32772996 未加载
oxff超过 2 年前
Best: Github, MDN, Rust standard lib docs, Stripe.<p>Worst: anything MS (excl. Github obv).
评论 #32770308 未加载
评论 #32771499 未加载
评论 #32770533 未加载
wizofaus超过 2 年前
If you&#x27;re actively trying to improve the docs then you&#x27;re already in the camp of &quot;what to do&quot;! Most likely the biggest challenge will be ensuring and enabling cultural change so that the documentation is regularly kept up to date. And obviously use the right platform - searchability, linkability (not just at the page level), ease of access and maintenance, etc. will probably make more difference to how successful your documentation is than writing style or level of detail etc.
dcminter超过 2 年前
Personally the thing I find most useful - and that is hardest to write - is a complete and realistic example of an entire flow.<p>For example on a recent API that I documented this needed to include a complicated OAuth flow (involving Swedish BankID), creation of several orders, and only then listing the actual account details.<p>Ideally you&#x27;ll have this as an explicit test case and hike appropriate excerpts directly into your documentation, ensuring that your example actually works even if the API changes! There&#x27;s nothing more frustrating than minutely explicit demonstration code that doesn&#x27;t reflect reality - and it&#x27;s very common!<p>Edit: I love the way that Rust&#x27;s documentation generator allows you to include code snippets that will cause the documentation generation to fail if the code doesn&#x27;t work! <a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;rustdoc&#x2F;write-documentation&#x2F;documentation-tests.html" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;rustdoc&#x2F;write-documentation&#x2F;docume...</a>
da4id超过 2 年前
I&#x27;ve always found heartcombo&#x2F;devise&#x27;s wiki to be a really easy read. I recall it was very helpful without too much info when I was just getting started. <a href="https:&#x2F;&#x2F;github.com&#x2F;heartcombo&#x2F;devise&#x2F;wiki&#x2F;How-Tos" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;heartcombo&#x2F;devise&#x2F;wiki&#x2F;How-Tos</a>.
username223超过 2 年前
The original Perl docs are some of the best, with a nice balance of motivating &quot;here&#x27;s how to accomplish what you want&quot; examples, and comprehensive reference material. It has grown flabby in newer versions, but parts of the original material remain.
bballer超过 2 年前
Use Open API and then something like <a href="https:&#x2F;&#x2F;stoplight.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;stoplight.io&#x2F;</a> and you will get first class API docs that automatically update with your spec changes.
评论 #32773164 未加载
croo超过 2 年前
Lifeway CMS documentation was catastrophic a few years back. It was beautiful and deceiving at first sight, undiscoverable, adhoc non-compete, unstructured, full with multiple ways of doing things of which may or may not work depending on minor version numbers, description detail and pure luck.
aintmeit超过 2 年前
The absence of documentation can be considered a form of tech debt, and tech debt can be deadly. In addition to what you&#x27;re endeavoring, you could ask yourself, what risks am I actually mitigating by back-filling missing or poorly written documentation? The answer should guide your decision making. Sometimes, it&#x27;s just a case of too little, too late.
and0超过 2 年前
Stripe is my #1, but lately I&#x27;ve found it&#x27;s a little to terse on how some edge cases might be handled, or the shape of the errors I might expect.
PaulHoule超过 2 年前
I like the Python docs and the Java docs. I don&#x27;t like the Clojure docs or the documentation for Javascript. The trouble w&#x2F; Clojure is that it takes some effort to wrap your head around the functional way of doing things -- Hickey&#x27;s book is a great supplement to the docs.
rozenmd超过 2 年前
It&#x27;s not an API, but I get frequent compliments for my project&#x27;s docs: <a href="https:&#x2F;&#x2F;onlineornot.com&#x2F;docs&#x2F;welcome" rel="nofollow">https:&#x2F;&#x2F;onlineornot.com&#x2F;docs&#x2F;welcome</a>
评论 #32778510 未加载
pajamasam超过 2 年前
Best for me: <a href="https:&#x2F;&#x2F;api-reference.checkout.com&#x2F;#tag&#x2F;Payments" rel="nofollow">https:&#x2F;&#x2F;api-reference.checkout.com&#x2F;#tag&#x2F;Payments</a>
asim超过 2 年前
Here&#x27;s an example of how we do API docs <a href="https:&#x2F;&#x2F;m3o.com&#x2F;db&#x2F;api" rel="nofollow">https:&#x2F;&#x2F;m3o.com&#x2F;db&#x2F;api</a>
r1jsheth超过 2 年前
best: stripe
mikejulietbravo超过 2 年前
following this