Showing posts with label api. Show all posts
Showing posts with label api. Show all posts

Wednesday, March 11, 2015

Retiring the Email Migration API

Posted by Wesley Chun, Developer Advocate, Google Apps

Last summer, we launched the new Gmail API, giving developers more flexible, powerful, and higher-level access to programmatic email management, not to mention improved performance. Since then, it has been expanded to replace the Google Apps Admin SDKs Email Migration API (EMAPI v2). Going forward, we recommend developers integrate with the Gmail API.

EMAPI v2 will be turned down on November 1, 2015, so you should switch to the Gmail API soon. To aid you with this effort, weve put together a developer’s guide to help you migrate from EMAPI v2 to the Gmail API. Before you do that, here’s your final reminder to not forget about these deprecations including EMAPI v1, which are coming even sooner (April 20, 2015).

Tuesday, March 10, 2015

Documents List API Best Practices Handling errors and exponential backoff

We have recently added a new section to the Google Documents List API documentation, titled Handling API errors. A number of developers in the forum have asked what to do when certain requests cause errors, and this documentation responds to their general need for better information.

This new documentation details all errors and the scenarios that cause them. We strongly recommend that both new and advanced Google Documents List API developers read the section thoroughly.

An important technique described in the new docs is exponential backoff. Exponential backoff helps clients to automatically retry requests that fail for intermittent reasons. For example, an application might make too many requests to the API in a short period of time, resulting in HTTP 503 responses. In cases like this, it makes sense for API clients to automatically retry the requests until they succeed.

Exponential backoff can be implemented in all of the Google Data API client libraries. An example in Python follows:
import random
import time

def GetResourcesWithExponentialBackoff(client):
"""Gets all of the resources for the authorized user

Args:
client: gdata.docs.client.DocsClient authorized for a user.
Returns:
gdata.docs.data.ResourceFeed representing Resources found in request.
"""
for n in range(0, 5):
try:
response = client.GetResources()
return response
except:
time.sleep((2 ** n) + (random.randint(0, 1000) / 1000))
print "There has been an error, the request never succeeded."
return None

We strongly recommend developers take about 30 minutes and update applications to use exponential backoff. For help doing this, please read the documentation and post in the forum if you have any questions.

Vic Fryzel profile | twitter | blog

Vic is a Google engineer and open source software developer in the United States. His interests are generally in the artificial intelligence domain, specifically regarding neural networks and machine learning. Hes an amateur robotics and embedded systems engineer, and also maintains a significant interest in the security of software systems and engineering processes behind large software projects.