7-Tips-on-How-to-Navigate-API-Documentation

7 Tips on How to Navigate API Documentation

Posted in

I have been working in developer relations for a few years now, and working with APIs has become not only part of my job but has sparked my interest and curiosity to focus on this subject. I am by no means an expert yet, but I have enjoyed learning as much as I can about APIs.

Throughout my time learning and working with APIs, I have become obsessed with API documentation. I will say that I’ve encountered various types of API documentation, ranging from good, bad, and ugly. From my experience, most documentation lacks consistency, has unclear descriptions or outdated information, and is difficult to get started with. Based on this, I have learned to navigate API documentation and work past my struggles most of the time.

With this blog post, I will share my seven tips for navigating API documentation, which is especially helpful for beginner creators and consumers. It also includes tips for API providers as well. I hope it helps you get past your struggles and frustrations, too.

This blog post is an adaption of the talk Gertrude Chilufya Westrin gave at the Nordic APIs Platform Summit 2023, Navigating API Documentation: Tips from the Trenches. You can watch the talk on YouTube here:

What is API Documentation?

API documentation is a set of written instructions that explain how to use API functions. It provides details about functions, classes, and return types, offering developers and consumers the information they need to build integrations and make API calls.

Tips for Navigating API Documentation

1. Read the Documentation

Reading the documentation will help you understand how the API works, especially if the documentation is well-written. To do this effectively, I specifically try to understand the following:

  • Authentication: Authentication and authorization are essential functions that make APIs work, and it helps to first understand which authentication methods are available. You need to know how to authenticate requests, understand error messages related to invalid authentication, and know how and where to get the API key or flow for the chosen authentication method.
  • Errors: Issues are bound to occur, and it can be intimidating for beginners. A good trick is to skim through documentation to understand potential error messages, their reasons, and potential solutions.
  • Methods: If you already know what you want to achieve, you can directly look for particular methods and endpoints. Just ensure that they are defined as you expect.

2. Have a Use Case in Mind

When I had just started working as a developer advocate, I struggled to create content around APIs because I was unfamiliar with use cases. So, this tip is more for API creators. As much as possible, spell out who should use your API and how.

It also helps to show multiple uses of endpoints in a sequence to achieve a goal, for instance, submitting an order for payment-related APIs or creating an automated email workflow triggered by different events for reporting or alerting.

3. Examples

Examples are a good way of showcasing the full potential of an API. Therefore, make it easy for developer consumers to use and understand your API with good code examples. If you can provide examples for each endpoint, that’s even better. For consumers, make sure to work with the provided examples as much as you can.

4. Consistency

This tip is a bit of an extension of the previous one. Having examples is great. Additionally, it’s better to have consistency with the API documentation. For instance, if a “create account” operation has an accountNumber in its inputs, avoid renaming it as accountId in the response. Consistency should also be reflected within the organization’s developer portal or platform.

Assuming that your examples offer different programming languages, ensure that these languages have as much consistency as possible with the degree of capabilities. For instance, you don’t want your Python examples to be so elaborate and easy to follow while your PHP examples are lagging. Finally, adhere to domain practices and use idiomatic code.

Consistency enhances the developer experience for users and increases credibility for creators.

5. Check the Changelog

This is one of my favorite tips. Before diving into documentation or using a new API, I quickly check the changelog to see if there are any changes to an API that I would like to work with.

In so doing, I approach the changelog with these questions in mind: are there any deprecated endpoints? Or breaking changes? How are response body models presented? Any new required parameters? Version number? Are there any new endpoints I should be aware of?

By asking these questions, I reduce the element of surprise while using said API. If possible, it’s also a good idea to subscribe to the changelog to stay updated on changes.

6. Documentation Maintenance

The value of maintaining docs cannot be over-emphasized. As a creator, ensure you have a strategy for handling documentation based on updates — this can easily be automated. A practical solution for maintenance is adopting a standardized process using the tools available today, such as OpenAPI Specification or Postman.

7. Leave It Better Than You Found It

Growing up, I was always encouraged to leave spaces, places, and homes better than I found them. So, I challenge you to do the same. Documentation can never be perfect, but it can always be better, so play your part by creating a PR with suggested improvements, raising an issue if you find bugs, or giving feedback, both good and bad. It not only helps the creators, but it also provides a better experience for the next user.

Great Documentation Enhances Developer Experience

Overall, good API documentation enhances the developer experience and makes users enjoy working with your product or service. In turn, this creates a loyal and engaged developer community, which could impact your revenue growth. If you found these tips helpful or would like to connect, please reach out.