Original link:
Reflection API design best practices
Finishing and thinking
Foreword
There is a saying which is particularly good, the system is not successful there are some special flash place, but bits and pieces of the design effort accumulated.
range
Discuss an issue needs to clarify its scope directed.
API Design Guidelines
First, we summed up the basic principles, the basic principle that is in compliance with those principles if we can make API designed to avoid most problems in the future evolution process.
- Provide a clear mental model
- Simple is simple
- Allow more time
Best Practices
POSIX File API
- Document Well written detailed documentation
- Choose the right level of the abstraction select the appropriate level of abstraction
- Naming and identification of the resource name and identification
- Conceptually what are the meaningful operations on this resource? For this object, the operating concept of what is reasonable?
- For update operations, prefer idempotency whenever feasible update, try to keep idempotency
- Compatibility compatible
- Batch mutations batch updates
- Be aware of the risks in full replace guard against the risk of replacing the entire update mode
- Do not create your own error codes or error mechanism do not try to create your own error code and returns an error mechanisms
The above is the main structure of this article, in addition to
providing two reference links to
Google Cloud API Guide
Microsoft API design best practices
Finally, attach a related article infoq for them to learn
me, GraphQL, Reflections on RESTful API RPC API: The API everyone is a designer