Steven Bazyl (@stevenbazyl)

Integrating with Google Apps New APIs & Features

Agenda • • • • •

Google Apps Overview Google Data Protocol & the Future of Google APIs Apps Script Picker API Distribution Opportunities

Google Apps

Google Apps • 3M+ businesses

Google Apps • 3M+ businesses • 4000+ new business each day

Google Apps • 3M+ businesses • 4000+ new business each day • 40M+ active users

Google Apps • 3M+ businesses • 4000+ new business each day • 40M+ active users • 200+ new features in 2010

Google Apps • 3M+ businesses • 4000+ new business each day • 40M+ active users • 200+ new features in 2010 • 99.9% uptime guarantee

100% Web for Business

APIs Data APIs

Hosting

UI Extensions

APIs Data APIs Calendar Tasks Contacts Gmail Docs & Spreadsheets Domain Management Sites

Hosting

UI Extensions

APIs Data APIs

Hosting

Calendar

App Engine

Tasks

Apps Script

Contacts Gmail Docs & Spreadsheets Domain Management Sites

UI Extensions

APIs Data APIs

Hosting

Calendar

App Engine

Calendar

Tasks

Apps Script

Sites

Contacts Gmail Docs & Spreadsheets Domain Management Sites

UI Extensions

Gmail

Google Data APIs

Google Data Protocol

Google Data Protocol

HTTP

HTTPS

Protocol

Google Data Protocol

Client Login

AuthSub OAuth 1.0 OAuth 2.0 HTTP

HTTPS

Auth Protocol

Google Data Protocol

Data Format

XML Client Login

AuthSub OAuth 1.0 OAuth 2.0 HTTP

HTTPS

Auth Protocol

Google Data Protocol

ATOM Data Format

XML Client Login

AuthSub OAuth 1.0 OAuth 2.0 HTTP

HTTPS

Auth Protocol

Google Data Protocol

ATOM

Open Search Data Format

XML Client Login

AuthSub OAuth 1.0 OAuth 2.0 HTTP

HTTPS

Auth Protocol

Google Data Protocol Google Data ATOM

Open Search Data Format

XML Client Login

AuthSub OAuth 1.0 OAuth 2.0 HTTP

HTTPS

Auth Protocol

Calendar Example http://www.google.com/calendar/feeds/default/private/full 2011-10-25T16:06:40.000Z sbazyl@google.com [email protected] Steven Bazyl ... Google Calendar 2008 1 25

This is all just preamble. We haven’t seen a calendar event yet!

Challenges for Developers

Challenges for Developers ➡ Requires knowledge/expertise in adjunct specifications

Challenges for Developers ➡ Requires knowledge/expertise in adjunct specifications ➡ Verbose data representation

Challenges for Developers ➡ Requires knowledge/expertise in adjunct specifications ➡ Verbose data representation ➡ XML not easy on some platforms

Challenges for Developers ➡ Requires knowledge/expertise in adjunct specifications ➡ Verbose data representation ➡ XML not easy on some platforms ➡ Client libraries out of date, missing on some platforms

Challenges for Developers ➡ Requires knowledge/expertise in adjunct specifications ➡ Verbose data representation ➡ XML not easy on some platforms ➡ Client libraries out of date, missing on some platforms ➡ Inconsistent feature sets

New API Stack

New API Stack

HTTPS

Protocol

New API Stack

OAuth 1.0

OAuth 2.0 HTTPS

Auth Protocol

New API Stack

CSV

ATOM

XML

OAuth 1.0

JSON OAuth 2.0

HTTPS

Data Format Auth Protocol

New API Stack

JSON

JSON

OAuth 2.0 OAuth 2.0 HTTPS

Data Format Auth Protocol

New API Stack

That’s it. JSON

JSON

OAuth 2.0 OAuth 2.0 HTTPS

Data Format Auth Protocol

Feature Consistency

Calendar

Contacts

Docs

...

Before: Each API had it’s own configuration of features

Feature Consistency

Calendar

Contacts

Docs

...

Before: Each API had it’s own configuration of features

Feature Consistency

Calendar

Contacts

Docs

...

Before: Each API had it’s own configuration of features

Feature Consistency

Calendar

Contacts

Docs

...

Before: Each API had it’s own configuration of features

Feature Consistency

Calendar

Contacts

Docs

...

Before: Each API had it’s own configuration of features

Feature Consistency

Calendar

Contacts

Docs

...

Before: Each API had it’s own configuration of features

Feature Consistency CSV

ATOM

XML ...

JSON

OAuth 1.0 Batching OAuth 2.0 Partial Fetch & Update Tasks

Calendar

...

...

After: Common stack, new features applied consistently across APIs

Available APIs • Lots of Google APIs already using this model. –Google+, Prediction, etc. • Google Apps: –Task API v1 –Calendar V3 soon –Others...eventually

Simpler Data Format { • Default format is JSON • Easy to construct, parse, and Text comprehend

"kind": "tasks#tasks", "etag": (value), "nextPageToken": (value), "items": [ { "kind": "tasks#task", "id": (value), "etag": (value), "title": (value), ... }, ...    ] }

Compact Data • Partial Retrieval & Update –Only get the data that your app needs –Only send the data that actually changes

• Great for mobile apps • Combine with GZIP for tiny payloads

Partial Response

Partial Response GET https://www.googleapis.com/tasks/v1/ lists/{LIST_ID}/tasks?fields=items(id %2Ctitle)&pp=1&key={YOUR_API_KEY} {"items": [ {"id": "MTEzNDMyODkwNDA0MjQ6MDoyNDI", "title": "Have fun"}, { "id":"MTEzNDMyODMDA0NjEjQ6MDozMjA", "title": "Do something useful"} ]}

Partial Update

Partial Update PATCH https://www.googleapis.com/tasks/ v1/lists/{LIST_ID}/tasks/{TASK_ID}? pp=1&key={YOUR_API_KEY} { "notes": "Partial updates are fun" }

Client Libraries - Discovery • Dynamic Discovery –JSON object –Describes resources, URLs, verbs, parameters, (schemas) –Always up to date –Discovery is just another API! https://www.googleapis.com/discovery/v1/apis

Client Libraries • “Generic” client libraries – Discover resources, URL templates, verbs – Use simple classes to represent resources – Generated POJOs to map JSON for strongly typed languages

• Implementations: –Java –.NET –Python –PHP –Ruby

Client Examples Java Tasks tasks = service.tasks .list(“@default”) .execute(); for (Task task : tasks.items) { System.out.println(task.title); }

PHP tasks = service.tasks() .list(tasklist = ‘@default’) .execute() for task in tasks[‘items’]: print task[‘title’] }

Generated classes for Java, .NET

Simple hashes for PHP, Python, Ruby, etc.

APIs Explorer

https://code.google.com/apis/explorer/

API Console

https://code.google.com/apis/console

Apps Script

Apps Script 101 • Javascript engine in the cloud, running on Google infrastructure • Great for workflow, process automation

Available APIs Google Apps Calendar Contacts Docs List Documents Spreadsheets Gmail Sites Tasks

Google APIs Finance BigQuery Url Shortener Prediction Translation

User Interface

Maps Charts GWT & UI Builder

Connectivity SOAP HTTP JDBC

Utilities

Logging User/Script Properties XML

Gmail Service • If you use Gmail, you already know the API –Compose –Inbox –Starred –Sent Mail –Labels –Search

GmailApp

GmailApp • There are just 3 objects: –GmailThread –GmailMessage –GmailLabel

GmailApp • There are just 3 objects: –GmailThread –GmailMessage –GmailLabel • Threads are composed of messages

GmailApp • There are just 3 objects: –GmailThread –GmailMessage –GmailLabel • Threads are composed of messages • Each thread can have multiple labels

GmailApp function getEmails() { var threads = GmailApp.search( ‘in:inbox is:unread’); var messages = []; for (var t in threads) { for (var m in t.getMessages()) { messages.push(m); } } return messages; }

DocumentApp

DocumentApp • Create a new document: –DocumentApp.create (name)

DocumentApp • Create a new document: –DocumentApp.create (name) • Open an existing document: –DocumentApp.openById (id)

DocumentApp • Create a new document: –DocumentApp.create (name) • Open an existing document: –DocumentApp.openById (id) • Documents are composed of elements: – DocumentBody – Paragraphs – Headers – Footers – ListItems – Tables

DocumentApp - Templates

Processing a template function processTemplate(templateId, values) { var newId = DocsList.getFileById(templateId) .makeCopy().getId(); var doc = DocumentApp.openById(newId); var body = doc.getActiveSection(); for (var key in values) { body.replaceText("%"+key+"%", values[key]); } return doc; }

Charts!

Charts API // Assemble data. var dataTable = Charts.newDataTable() .addColumn(Charts.ColumnType.STRING, "Quarter") .addColumn(Charts.ColumnType.NUMBER, "Income") .addColumn(Charts.ColumnType.NUMBER, "Expenses") .addRow(["Q1", 50, 60]) .addRow(["Q2", 60, 55]) .addRow(["Q3", 70, 60]) .addRow(["Q4", 100, 50]) .build();

Charts API // Build the chart. var chart = Charts.newColumnChart() .setDataTable(dataTable) .setColors(["green", "red"]) .setDimensions(600, 400) .setXAxisTitle("Quarters") .setYAxisTitle("$") .setTitle("Income and Expenses") .build();

UI Builder

Referencing UI Components function doGet() { var app = UiApp.createApplication(); var component = app.loadComponent ("MyGui"); app.add(component); return app; }

Demo - http://goo.gl/nKOhN

Even more new things! New APIs: • Big Query • Prediction • Tasks • URL Shortener

Picker API

Picker API

Picker API

Picker API • Implicit OAuth 2 access token for selected docs

var doc = data.docs[0]; var accessToken = doc.accessToken; var resourceId = google.picker.ResourceId.generate(doc);   ... • Localization

google.load('picker', '1' {'language':'fr'}); • Picasa Web Albumbs, Image Search, Video Search too!

Distribution

Google Apps Marketplace

What’s new in the Marketplace

What’s new in the Marketplace • Installable apps for individual users

What’s new in the Marketplace • Installable apps for individual users • “Staff Picks” feature in the home page

What’s new in the Marketplace • Installable apps for individual users • “Staff Picks” feature in the home page • Improved searching & analytics

Single Sign-On

Single Sign-On

Many integration Points

Domain Users & Groups

Calendar

Contacts

Documents List

Sites

Spreadsheets

Gmail IMAP+SMTP

Gadgets

Summary

Summary • 100% cloud for business • Google Apps just part of the solution, need additional solutions from developers like you • Lots of tools available! –Apps APIs like tasks, contacts, calendar, etc –Apps Script for automation & workflow –Easy doc integration with Picker API • Distribution options via Google Apps Marketplace

Resources and Q&A • Apps Script & OpenID/OAuth talks later today • Marketplace: http://www.google.com/enterprise/ marketplace • Docs & forums at http://code.google.com/googleapps • Our blog: http://googleappsdeveloper.blogspot.com • Twitter – @GoogleAppsDev, @ryguyrg, @scottmcmullan, @stevenbazyl

Integrating with Google Apps

APIs. Data APIs. Hosting. UI Extensions. Domain Management. Calendar. Contacts. Gmail. Docs & Spreadsheets. Tasks. Sites. App Engine. Apps Script ..... Many integration Points. Domain Users & Groups. Calendar. Contacts. Documents List. Sites. Spreadsheets. Gmail IMAP+SMTP. Gadgets ...

2MB Sizes 3 Downloads 202 Views

Recommend Documents

No documents