Automating Business
with Google APIs
David Hodge
Thursday, March 7, 13
Slide 2
Slide 2 text
Thursday, March 7, 13
Slide 3
Slide 3 text
Thursday, March 7, 13
Slide 4
Slide 4 text
Thursday, March 7, 13
Slide 5
Slide 5 text
Thursday, March 7, 13
Slide 6
Slide 6 text
We automate business processes
using cloud computing and
machine learning.
Dave & Bediako
Thursday, March 7, 13
Slide 7
Slide 7 text
IAAS and PAAS
- Amazon, Google, Microsoft
- DevOps, NoOps, OOPs
- Beware single point of
failure - read SLAs
Thursday, March 7, 13
Slide 8
Slide 8 text
Google Docs Drive
• Google Docs API deprecated
• Google Drive Polyglot API - .NET, Java,
Dart, Go, GWT, Java, Javascript, Objective-
C, PHP, Python, Ruby
• ReSTful API - create and manage
documents
Thursday, March 7, 13
Slide 9
Slide 9 text
Google Spreadsheets
API
• Spreadsheets, Worksheets, List Row, Cell
• Create, Delete, Share
• List Based Feeds vs Cell Based Feeds
• Updating multiple cells with Batch
Thursday, March 7, 13
Slide 10
Slide 10 text
Google Spreadsheets
API
• Gotchas
• Queries - age > 25 and height < 175
Thursday, March 7, 13
Slide 11
Slide 11 text
Google Apps Scripts
• Javascript cloud scripting language
• Automate workflows
• Customize spreadsheets
• Schedule Tasks
• Save data using Spreadsheets, JDBC,
ScriptDB
Thursday, March 7, 13
Slide 12
Slide 12 text
Google App Engine
Thursday, March 7, 13
Slide 13
Slide 13 text
Google App Engine
Backends
Thursday, March 7, 13
Slide 14
Slide 14 text
Google App Engine
Backends
Storing
Data
Thursday, March 7, 13
Slide 15
Slide 15 text
Google App Engine
Backends
Storing
Data
Blobstore
Thursday, March 7, 13
Slide 16
Slide 16 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Thursday, March 7, 13
Slide 17
Slide 17 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Thursday, March 7, 13
Slide 18
Slide 18 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities
Thursday, March 7, 13
Slide 19
Slide 19 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel
Thursday, March 7, 13
Slide 20
Slide 20 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Thursday, March 7, 13
Slide 21
Slide 21 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images
Thursday, March 7, 13
Slide 22
Slide 22 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs
Thursday, March 7, 13
Slide 23
Slide 23 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Thursday, March 7, 13
Slide 24
Slide 24 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache
Thursday, March 7, 13
Slide 25
Slide 25 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy
Thursday, March 7, 13
Slide 26
Slide 26 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy OAuth
Thursday, March 7, 13
Slide 27
Slide 27 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy OAuth
Prospective
Search
Thursday, March 7, 13
Slide 28
Slide 28 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy OAuth
Prospective
Search
Search
Thursday, March 7, 13
Slide 29
Slide 29 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy OAuth
Prospective
Search
Search
Task
Queues
Thursday, March 7, 13
Slide 30
Slide 30 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy OAuth
Prospective
Search
Search
Task
Queues
Users
Thursday, March 7, 13
Slide 31
Slide 31 text
Google App Engine
Backends
Storing
Data
Blobstore
App
Identity
Google
Cloud
Storage
Capabilities Channel Endpoints
Images Logs Mail
Memcache Multitenancy OAuth
Prospective
Search
Search
Task
Queues
Users
XMPP
Thursday, March 7, 13
Slide 32
Slide 32 text
One does not simply
Automate using Google
APIs
Thursday, March 7, 13
Slide 33
Slide 33 text
How we build software
A Customer
has a nick name
has a full name
has a date of birth
has a social security number which is sensitive
can be viewed or created or changed by a customer service
representative
An Order
belongs to a Customer
has a description
can be viewed or created or changed by a customer service
representative
An Order Line Item is audited
belongs to an Order
has a description
has a price which is a number
can be viewed or created or changed by a customer service
representative
Dictation + Airlift on
Google App Engine
Thursday, March 7, 13
Slide 34
Slide 34 text
Current processes manual
and paper based for recording
line items for accounts
receivable and accounts
payable.
Thursday, March 7, 13
Slide 35
Slide 35 text
Customer Widgets
Spreadsheets
Thursday, March 7, 13
Slide 36
Slide 36 text
Widget Maker
Spreadsheets
Thursday, March 7, 13
Slide 37
Slide 37 text
Evolution One - Cron
/accounting/receivable
Process widgets sold for accounting line items
every day 12:30
America/New_York
/accounting/payable
Process line items for widget making workers
every day 03:30
America/New_York
Thursday, March 7, 13
Slide 38
Slide 38 text
Evolution Two -
Backends
• Use Backends to process long lived
requests - No Request Deadlines
• Higher CPU up to 4.8GHz and Memory
limits - up to 1GB
• Also using Spreadsheet Batch
Thursday, March 7, 13
Slide 39
Slide 39 text
Evolution Two -
Backends
• Dynamic vs Resident - Dynamic Backends
become alive only on request and are
turned off when idle
Thursday, March 7, 13
Slide 40
Slide 40 text
Evolution Two -
Backends
true
true
B8
backends.xml
/accounting/receivable
Process widgets sold for accounting line items
every 20 minutes
America/New_York
accounting
/accounting/payable
Process line items for widget making workers
every 40 minutes
America/New_York
accounting
cron.xml
Thursday, March 7, 13
Slide 41
Slide 41 text
Task Queues work discretely on a
unit of work
Push - processes tasks based on
rate configuration, auto scales
Pull - allows for specific time and
timeframe to run
Thursday, March 7, 13
Task Queue Headers
• X-AppEngine-QueueName, the name of the queue (possibly default)
• X-AppEngine-TaskName, the name of the task, or a system-generated
unique ID if no name was specified
• X-AppEngine-TaskRetryCount, the number of times this task has
been retried; for the first attempt, this value is 0. This number includes
attempts where the task failed due to a lack of available instances and
never reached the execution phase.
• X-AppEngine-TaskExecutionCount, the number of times this task
has previously failed during the execution phase. This number does not
include failures due to a lack of available instances.
• X-AppEngine-TaskETA, the target execution time of the task, specified
in microseconds since January 1st 1970.
Thursday, March 7, 13
Slide 44
Slide 44 text
Task Push Queues
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import static com.google.appengine.api.taskqueue.TaskOptions.Builder.*;
//Discrete job for processing single widget to write customer line item
Queue queue = QueueFactory.getDefaultQueue();
queue.add(withUrl("/widgetorderforcustomerjob").param("widgetKey", key));
//Discrete job for processing single widget to write vendor line item
queue.add(withUrl("/widgetorderforvendorjob").param("widgetKey", key));
Thursday, March 7, 13
Slide 45
Slide 45 text
Google Docs
Google App
Engine
Automation Achieved
Receivable Line
Items Job
Payable Line
Items Job
Google
Spreadsheet
Line Items Per
Client
Google
Spreadsheet
Line Items Per
Vendor
Invoices
Payments
Thursday, March 7, 13
Slide 46
Slide 46 text
Experiment
Evolve
Architecture
Thursday, March 7, 13
Slide 47
Slide 47 text
Support
• Google Plus Hangouts
• Google Forums
• Fellow Developers
Thursday, March 7, 13
Slide 48
Slide 48 text
Some More Tips
• Python: Bulk Loader Tool to download/
upload data - good for any flavor of GAE
• Get involved - NoOps doesn’t mean you
don’t have to know your technology stack
• https://github.com/LucidTechnics/google-
apps-util
• https://code.google.com/p/googleappengine/
wiki/WillItPlayInJava
Thursday, March 7, 13
Slide 49
Slide 49 text
“Using no way as a way,
having no limitation as limitation.”
- Bruce Lee
Thursday, March 7, 13
Slide 50
Slide 50 text
Official White House Photo by Pete Souza
Thursday, March 7, 13