Google_data.bat
October 2nd, 2007 | Published in Google Code
Computers love to do repetitive tasks. We love them to do these tasks for us. What more can we ask of them? Perhaps doing multiple operations at the same time! Now two more Google products have batch support available in their API: Google Calendar and Google Spreadsheets.
Batch support allows you to perform multiple actions on Atom entries in a GData-based feed at the same time. You can perform any combination of update, query, insert, and delete operations on different entries in one request to the web service. This is accomplished by constructing a "feed" of entries, each with their own batch operation and an optional identifier. This feed is then sent to the web service and each entry is processed like it was an individual POST, PUT, or DELETE request. The result of this operation is a feed of entries, containing the server's response to each entry that was submitted along with status information (such as if the operation on the entry was successful) and the optional batch id, if you provided one originally.
Usually the slowest part of interacting with the API is the actual HTTP request made from your program to the web service. By batching your requests you can now update cells in a spreadsheet or sync up calendar events in a fraction of the time previously required!
The following batch support exists in the Google data APIs: Spreadsheets has enabled it for the cells feed, Calendar has enabled it for the events feed, and Base has enabled it for items feed. Specifics of how to implement batch support for these APIs can be found in their developer guides:
- Spreadsheets developer guide
- Calendar developer guide
- Base developer guide
If you have problems using the batch feature in a particular API, you can ask in one of the developer support forums:
- Spreadsheets Group
- Calendar Group
- Base Group
Go forth, and create a batch of tasty Atom entries!