Partial Response and Updates with Google APIs

Last year google launched support for partial response and updates to a couple of the Google APIs. The goals was to significantly reduce network, memory, and CPU resources needed to work with Google APIs.

Now Google is adding support for partial response, and an improved version of partial update, called patch, to a number of newer APIs including:

All APIs available in the Google APIs Discovery Service and the APIs Explorer supporting partial response and updates.

The partial response algorithm works by supplying a fields query parameter to any API call that returns data, you can request specific fields.

Here is an example request that returns only titles and timestamps of a user's public Buzz activities:[email protected]/@public?alt=json&pp=1&fields=items(title,updated)

A full response for Buzz activity would be around 53KB and the partial response is 3KB, a reduction of almost 95%!

You can try out both partial response and patch algorithms in the Google APIs Explorer. In partial responses, the fields parameter is available for most methods. You can easily tell which are partial update methods by the .patch in the method name. Both the fields parameter and the patch method on the tasklist resource in the APIs explorer.

Partial response and updates are a great way to make APIs more efficient for devices with limited connectivity, as well as making API platforms operate as efficiently as they can by delivering only what information is needed.

Google is in a unique position with the number of APIs they offer, volume of API calls they manage, and wide audience they deliver to. We can all learn a lot from watching them organize their APIs, and apply elements of their approach to our own API ecosystems.