BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Makes Public Their API Design Guide

Google Makes Public Their API Design Guide

Leia em Português

This item in japanese

Lire ce contenu en français

Bookmarks

Google has made public an API Design Guide for creating HTTP or RPC APIs. These design principles are recommended especially to developers creating gRPC APIs connecting to Google Cloud Endpoints.

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 Create, Delete, Get, List, and 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 1.0.0-alpha.

The guide contains more details and examples on resources, standard and custom methods, standard fields, errors, creating APIs with proto3 and others.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT