Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
What goes into creating the best API documentation is a contentious subject.
Most developers have their own opinions on what should and shouldnât go in to API documentation. Itâs rare for everyone to agree.
Everything from what you put in it to how things are laid out will affect the experience for your customers. Thatâs why getting it right is so crucial.
Fail to get it right and you risk deterring prospects from using your API because they donât understand how things work, or worseâââa slew of support tickets that take up everyoneâs time.
I spoke to Cronofyâs development team to find out more about how they approach writing ours.
Consider it when developing a new feature
Photo by rawpixel on Unsplash
âNot considering your API documentation as part of your product is usually the root cause of bad documentation,â says Stephen, our Senior Developer.
âThe API documentation is the first thing we consider whenever we are developing a new feature. We often have long discussions about the correct terminology for each property, trying to avoid ambiguity wherever we can.â
This is important to ensure that itâs as simple and easy-to-understand as possible.
The vaguer your description of a feature or element of it is, the more likely it is to confuse customers and the more support requests youâre likely to get.
âNot considering your API documentation as part of your product is usually the root cause of bad documentation.ââââStephen, Senior Developer, Cronofy
Factoring in the documentation while building the new feature also gives you time to work through any issues. Customers can give you feedback during Alpha and Beta phases, further allowing you to refine the docs before it goes live.
Stephen continued by saying this: âThe API design does change during our development phase. Often when we write SDK and format documentation we spot things weâd like to tidy up before making things public as we never change our public API.
âAnother key aspect of this is our Alpha and Beta phases where we rely on our customers to let us know how fit for purpose the documentation is.â
When the product does go live, you can be sure that youâve worked out most of the kinks and it will help your users get to grips with the new feature.
Have clear examples
Photo by rawpixel on Unsplash
âWith the most complex API methods giving examples and extra supporting documentation is essential. If you donât do this youâll often be paying this back though additional support requests,â says Garry our CTO.
âWith the most complex API methods giving examples and extra supporting documentation is essential.ââââGarry, CTO, Cronofy
âMany of our endpoints have optional parameters, but thereâs a common set that are required and optional ones we recommend are set. So I start with a request that reflects those best practices, and the kind of response that can be expected to be received in return.
âThis provides a context around which to explain all possible parameters, what their potential values are, what their defaults are if they arenât provided, and finally what that all means together.â
By starting with an example, you put an image in peopleâs heads. This image helps with their understanding. Customers and prospects will understand your product/feature much faster with an explanation like this.
Common usage examples also incorporate storytelling to show your users what they could create.
The more context you provide for your customers, they more likely they are to understand the feature and be excited about adding it to their software.
Usability and consistency are key
Photo by NESA by Makers on UnsplashâSimple things like making the documentation available offline or adding deep linking really help.ââââStephen, Senior Developer
Usability is a must in all aspects of software development, and API documentation is no different.
âKey things like usability, consistency, and features are often overlooked. Simple things like making the documentation available offline or adding deep linking really help,â says Stephen.
âMy pet peeves are when you have parts of the documentation which contradict themselves or leave things as ambiguous. It doesnât matter if you know what the behaviour is, write it down so others do too.
âFor example, if the definition of a property states a value must be greater than zero but the validation states the value must be positive, the implementer must make a decision if 0 is a valid input.â
Donât rely on tools to generate it for you
Photo by Tyler Franta on Unsplash
Itâs easy to want to rely on tools to do things for you, but if you want to create the best experience for your users, this isnât the best way to go.
âYou see things such as a thing having a field named âcommentâ and a description of âthe thingâs commentâ. This doesnât tell you what type it is, or could be, though you might guess itâs a string. Nor does it tell you the format of that string. It could be plain text, HTML, Markdown, or something else. It doesnât tell you how long that string may be so you can cleanse your requests and size your database field appropriately. It doesnât tell you whether itâs ASCII, UTF-8, or something else so you can use the correct type of encoding,â says Garry.
âThereâs just so much you then have to work out yourself as the developer, and that compounds over every developer that uses that API. So what saves the publisher a few hours costs their customers hours each.â
âItâs easy to want to rely on automation tools to fix things for you, but if you want to create the best experience for your users, this isnât the best way to go.ââââGarry, CTO
Sometimes the time and cost savings for you arenât worth it when you consider the end-user experience. And really, isnât how your customers feel the most important thing? If they donât like what youâre doing, theyâre less likely to recommend you to their network, which means less custom for you.
A great experience, on the other hand, means theyâre more likely to recommend you to their network, further increasing your influence, attracting new customers, and giving you more money to build more features.
Conclusion
Photo by Rishi Deep on Unsplash
What makes great API documentation may be a contentious subject, but for the most part, the basics are pretty simple:
- Consider it as part of your feature, not an after thought
- Have clear examples
- Be consistent
- Think about the user experience
- Donât rely on tools to generate it for you
All these elements work together to ensure that your customers fully understand what they can build when they use your API. This means theyâre more likely to use it to its fullest.
A well-documented API also means youâre less likely to get frequent support tickets from customers who donât understand how X or Y feature works or why something doesnât do what they want it to.
Taking the extra time to put together a consistent, well-considered documentation will pay dividends in the long run.
What do you think makes for great API documentation?
Try our API
If youâre a developer and want to see how easy it is to add two-way calendar sync to your software, head over to our website where you could be making your first API call in minutes.
Not a developer? Connect your calendar to your favorite appsâââincluding Trello, Slack, and Evernoteâââusing our free Calendar Connectors.
How to Write Great API Documentation Every Time was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.