Google Makes Public Their API Design Guide
Google has been using internally this design guide since 2014 when creating cloud or other services APIs. The guide discusses the design of HTTP or RPC APIs. While acknowledging the merits of HTTP APIs (also called REST APIs), mentioning that there are times when they make sense to be used, Google prefers RPC and especially its variant gRPC. While most of the internet APIs are HTTP, those used internally by cloud and service providers are usually RPC, greatly outnumbering HTTP APIs, according to Google.
Google recommends a REST-like approach to designing RPC APIs, at the foundation being one or more resources that are operated upon with methods. Resources, also know as domain entities, are identified through URIs or unique names (IDs) following a network path format. Resources of the same type can be grouped in collections.
The standard methods to be used are
Update. One can create custom methods for operations that cannot be mapped to one of the standard ones, such as database transactions. It is recommended to use as many resources as necessary with a small number of methods.
The following steps are suggested to be made when creating resources:
- Determine what types of resources an API provides.
- Determine the relationships between resources.
- Decide the resource name schemes based on types and relationships.
- Decide the resource schemas.
- Attach minimum set of methods to resources.
For versioning, Google uses semantic versioning represented by three numbers as in
MAJOR.MINOR.PATCH. A prerelease version is indicated with a suffix, such as
The guide contains more details and examples on resources, standard and custom methods, standard fields, errors, creating APIs with proto3 and others.