BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Google Makes Public Their API Design Guide

| by Abel Avram on Mar 10, 2017. Estimated reading time: 1 minute |

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 Stage
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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT