For a good Blockchain API, good API design is key. It is important to understand that the user of the API is not a company, but the software developer. Therefore, the primary goal should be to make the API as appealing as possible for the developer. Only then will the API be used and recommended. But how do we do that?
Software developers want to be lazy, not in a negative sense, but in terms of efficiency. It should be possible to use the API quickly and easily. So what does an API have to be like to allow developers to be “lazy”? For this, the API:
- Well documented
- And be opinionated
What exactly is meant by this we will explain to you in the following.
1. API Principles: Intuitive
To enable the developer to be lazy, the API must be intuitive. This means he doesn’t have to spend a lot of time figuring out how the API works. It should be as self-explanatory as possible and tell the developer what to do. There are two rules you should follow:
Rule 1: Similar things should look similar. This means that using the same word pattern should be used to show that two or more methods, classes, etc. have the same meaning.
Rule 2: Dangerous things should look dangerous. For example, if a class or method does dangerous things, they should also look dangerous. This is to make the developer aware of the danger.
2. API Principles: Documentation
For the API to be a success, it must not only be intuitive but also well documented. It is crucial that the documentation of the API is well-structured and easy to understand. The goal is that almost every question can be answered easily and quickly by the documentation. There are four rules to follow.
- Simple questions should be answered simply
- The documentation should be boring but well-structured
- The tutorials should be interesting
- A quickstart to get the API up and running as fast as possible
3. API Principles: Opinionated
The last important factor for a successful API is opinion strength. This means that it must feel to the customer as if the API was built by one person only. Therefore, you have to define standards in advance. The goal here is that all employees involved in the development of the API should think like one person. The result is a powerful API that points the customer in the right direction. It also makes it difficult to misuse the API. This can significantly contribute to the success of the API.
These are our three success factors for a good API. If you take all factors into account and implement them in your API design, your API can be accepted in the market and be successful.