Download - Google api應用入門
![Page 1: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/1.jpg)
GOOGLE API應用入門
MiCloud Robin / Simon
![Page 2: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/2.jpg)
● 漫遊Google API● Google的API工具
○ API Console介紹○ API Explore介紹
● 從認證開始○ OAuth2
● Google API的使用○ 從Calendar API開始○ 玩玩Drive API
● 淺談進階的API操作 - Apps Script
Outline
![Page 3: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/3.jpg)
Why Here...Cloud Changes the Developer
曾幾何時...● system and os● network setup● install what I need● mail sdk● sms bridge● backup and archive● socket protocol● using versioning for
develop● ...
現在...● cloud machine● vpc and permission● software preload● email service● sms service● object storage● restful protocal● git supported
deploy● ...
![Page 4: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/4.jpg)
So....
Familiar cloud to be your weapon... Focus Core Business to Earn Money...
![Page 5: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/5.jpg)
漫遊Google API - 從服務開始
SERVICE
API
![Page 6: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/6.jpg)
漫遊Google API - 這堂課很難(上)...
![Page 7: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/7.jpg)
Start Implements of API
RESTSDK
Web
Mobile
Developers use non-standard language
Developers use standard toolkits
End users
End users
![Page 8: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/8.jpg)
API使用流程 - 讀懂怎麼用
Active Your API
Read the Document
IntegrateAuthenticateRequest API
Integrate
![Page 9: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/9.jpg)
Learning Resources -https://developers.google.com/
![Page 10: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/10.jpg)
Google API Console - Services
API Name
APIOn/Off
Notes for limit
Help page & documents
![Page 11: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/11.jpg)
Google API Console - Access Control
Access Control
Project Info
Project Setting
ID info list
![Page 12: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/12.jpg)
Google API Console - Reports
Usage Report
![Page 13: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/13.jpg)
After Turn ON API....
![Page 14: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/14.jpg)
What is API...
Condition Input
Resource Output
![Page 15: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/15.jpg)
Google API Explore
![Page 16: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/16.jpg)
Google API Explore - Multi-Versions
![Page 17: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/17.jpg)
Google API Explore - Auth
Operation Scope
![Page 18: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/18.jpg)
Google API Explore - Query
![Page 19: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/19.jpg)
Google API Explore - REST & Results
REST Request
Sample
Request
Results
![Page 20: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/20.jpg)
Google API Java Client
https://code.google.com/p/google-api-java-client/wiki/APIs#oauth2
![Page 21: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/21.jpg)
Google API .NET Client
http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Oauth2
![Page 22: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/22.jpg)
Google API Node.js Client
https://github.com/google/google-api-nodejs-client
![Page 23: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/23.jpg)
Other Language Support
![Page 24: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/24.jpg)
Authenticate with Oauth2.0
![Page 25: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/25.jpg)
● OAuth 2.0● OAuth 1.0● Hybrid protocol(OpenID
+ OAuth)● OpenID
Google Implemented Auth(s)
![Page 26: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/26.jpg)
Oauth2 Client Login Flow
Redirect URL
to MiCloud
![Page 27: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/27.jpg)
An Example - MiCloud Oauth Login1 2
3
![Page 28: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/28.jpg)
Service Owner在Google的設定
![Page 29: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/29.jpg)
Oauth優點
● 簡單:不管是 OAuth 服務提供者還是應用開發者,都很容易於理解與使用
● 安全:沒有涉及到使用者金鑰等資訊,更安全更靈活
● 開放:任何服務提供者都可以實現 OAuth,任何軟體發展商都可以使用 OAuth
![Page 30: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/30.jpg)
Use of Google API - Calendar & Drive
![Page 31: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/31.jpg)
What Calendar API can do...Functions● acl● calanderList● calendars● events● setting● ...
![Page 32: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/32.jpg)
Connect Calendar API
![Page 33: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/33.jpg)
Select your Operation..
![Page 34: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/34.jpg)
Read the request and result
$ curl https://www.googleapis.com/calendar/v3/users/me/calendarList/mitac.com.tw_4gqp4u0bit7....o%40group.calendar.google.com -H "Authorization: Bearer ya29.AHES6ZSBtCsGQhpkmB....jcbOSY46jflrKKa4"{
"kind": "calendar#calendarListEntry", "etag": "\"hTTG_yZRNM6RHYgIq0uRTKezdKo/GXuSxc1o...Vkx1AgpzIOs\"", "id": "[email protected]", "summary": "7C2 假表", "description": "請貼上自己的假\nex: 姓名/事由", "timeZone": "Asia/Taipei", "colorId": "3", "backgroundColor": "#f83a22", "foregroundColor": "#000000", "selected": true, "accessRole": "owner"
}
![Page 35: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/35.jpg)
API Explore Response
![Page 36: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/36.jpg)
About Drive
Gapps +
Space
HTTP Server+
Google APIs
HTTP Access+
Market
● OA應用服務● 資料儲存
● 更多應用程式● Mobile應用● 全世界的展示平
台
● Simple Web● RESTful● 更多客製化的應
用● Google服務結合
![Page 37: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/37.jpg)
Chrome store integrate
![Page 38: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/38.jpg)
Drive best integrate platform
![Page 39: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/39.jpg)
Use Apps Script
![Page 40: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/40.jpg)
![Page 41: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/41.jpg)
淺談一下Apps Script
● JavaScript like programming language● Cloud IDE integrate to Drive● Easy access to Google services● Some container integrate● Free!● Robust!
![Page 42: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/42.jpg)
Apps Scripts目前種類
● Standalone Scripts● Container-Bound Scripts● Spreadsheet Custom Functions● Web Apps● Google Sites Gadgets● Container Extensions
![Page 43: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/43.jpg)
Create Your Apps Script
![Page 44: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/44.jpg)
What can I do - Simple HTTP Monitor
![Page 45: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/45.jpg)
Piece of Code
![Page 46: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/46.jpg)
Save data to sheet and setting chart
![Page 47: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/47.jpg)
Or - Using RESTfulPiece of Code
![Page 48: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/48.jpg)
Deploy & Publish
![Page 49: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/49.jpg)
Testing in curl
URL Pattern:https://script.google.com/macros/s/:id/exec
Script ID
![Page 50: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/50.jpg)
Testing in Ajax Code...
![Page 51: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/51.jpg)
Apps Script可行的應用
● 結合Drive應用,做排成、資料顯示、互動...等● 結合Github Page, Cloud CMS等軟體,這些純
靜態HTML的頁面也可以有動態的結合● 結合Mobile的應用,讓Apps Script當做Mobile
的Server端,資料庫資源部分則可以使用Apps Script呼叫RDB, NDB, BigQuery...等
● 結合Chrome Extension的應用...
![Page 52: Google api應用入門](https://reader036.vdocuments.site/reader036/viewer/2022062303/555492f5b4c905186d8b48d5/html5/thumbnails/52.jpg)
● Oauth 2: http://oauth.net/2/● Oauth1&2差異:
○ http://www.cnblogs.com/lingyun1120/archive/2011/12/12/2284788.html
○ http://blog.sina.com.cn/s/blog_4c9ba28501015ux6.html
● Google API Console: https://code.google.com/apis/console
● Google API Explore: https://code.google.com/apis/explorer/
● Apps Script Site: http://www.google.com/script/start/● Apps Script Docs: https://developers.google.com/apps-
script/
Reference