Technical Writing Best Practices for Bookshop API Documentation
This documentation was created following several best practices to ensure clarity, usability, and accuracy. Below are some of the key principles applied:
1. Writing in Plain Language
Plain language is used throughout the documentation to make content accessible. The goal is to write in a way that can be easily understood by readers with varying levels of technical expertise.
Techniques:
- Use Clear and Simple Language: Avoid jargon and complex terms unless necessary, and explain them when they are used.
- Bottom Line Up Front (BLUF): Start with the main point or action, ensuring users can quickly understand what is needed.
- Direct Address: Use second-person pronouns like "you" to engage the reader and make instructions feel more personal and direct.
2. Structuring Content for Skimming
Readers often skim API documentation to find the information they need quickly. This documentation uses several strategies to support skimming:
Techniques:
- Headings and Subheadings: Organize content into clear sections with descriptive headings to help readers find information at a glance.
- Short Paragraphs and Lists: Break down complex information into short paragraphs or bulleted lists to make it more digestible .
- Code Examples and Formatting: Provide code snippets with syntax highlighting and realistic values to make them easy to understand and copy .
3. Consistent Use of API Documentation Sections
The documentation follows a structured approach, which includes five common sections for each API endpoint:
- Resource Description: Provides a brief overview of the resource, its purpose, and key details .
- Endpoints and Methods: Lists available endpoints and HTTP methods, using curly braces to indicate path parameters.
- Parameters: Documents path, query, header, and body parameters with descriptions and constraints .
- Request Example: Offers sample requests to illustrate how to interact with the API .
- Response Example and Schema: Shows expected responses and defines the data structure, including JSON formatting and realistic values.
4. Use of Outcome Statements
To set user expectations, outcome statements are included at the beginning of sections. These statements help users understand the purpose of the documentation and what they can achieve by following it.
Example:
"This Quick Start Guide provides the essential steps needed to integrate the Bookshop API into your application, enabling you to perform operations such as creating and managing books and authors."
5. Best Practices for Code Examples
Developers rely heavily on code examples when using API documentation. The following practices were applied:
- Provide Examples for Every Use Case: Include examples for different types of requests (GET, POST, PUT, DELETE) .
- Use Realistic Data: Avoid using placeholders or fake data that may confuse users; opt for realistic but fictitious data instead .
- Test the Examples: Code examples were tested to ensure they work as intended and reflect the actual API behavior .
6. Error Handling and Status Codes
Status codes and error messages are documented clearly, describing what each code means and providing guidance on handling errors. This helps developers anticipate and manage potential issues when interacting with the API.
Techniques:
- List Common Status Codes: Such as 200 OK, 400 Bad Request, 401 Unauthorized, and 404 Not Found, with explanations of each .
- Provide Error Response Examples: Show how the API returns error messages, including the format and structure of the response body.
7. Using the Imperative Mood
Instructions are written in the imperative mood (command form) to make them concise and actionable. This approach helps users understand exactly what to do without ambiguity.
Example:
Instead of writing "The user should click 'Submit'," the documentation uses "Click 'Submit'" to make the action clear.
8. Handling Complex Data Structures
When documenting nested JSON objects or complex data, a table or structured approach is used to clarify the hierarchy and relationships between different fields .
Techniques:
- Table Representation: Document nested fields in a tabular format to illustrate their relationships.
- Use of Example Values and Models: Show both example JSON responses and the underlying schema for clarity.
9. Addressing User Needs
The documentation is designed based on user feedback and common questions. It focuses on solving real user problems and includes features like Quick Start Guides and detailed API reference sections.
By following these best practices, the Bookshop API documentation ensures clarity, usability, and comprehensive coverage, making it easy for developers to integrate and use the API effectively.