SlideShare a Scribd company logo
1 of 38
Google Drive and the
Google Drive SDK
Building Drive apps
Abdelhalim Lagrid
Google Developer Group, Algiers
1
Introduction :
One of Cloud google’s products : lunched in 2012 ..known by Google
Drive API .
What is Google Drive?
Yea, some marketing :)

2222
Access Anywhere
Google Drive is everywhere you are -- on the
web, in your home, at the office, and on the go.
So wherever you are, your stuff is just...there.
Ready to go, ready to share.
Install it on:

PC, Mac, Android, iOS
Store your files in a safe place

Things happen. Your phone goes for a swim.
Your laptop takes an infinite snooze.
No matter what happens to your devices, your
files are safely stored in Google Drive.
Powerful search

Google Drive can search keywords
in your files -- even the text in
pictures -- to help you quickly find
what you're looking for.
View anything

When a coworker shares a file with
you, you may not have the supported
software on your computer. With
Google Drive you can open and view
over 35 file types directly in the
browser.
Access to a world of apps!
Google Drive works with the apps
that make you more efficient.
Choose from a growing set of
productivity applications, integrated
right into your Drive.
Google Drive SDK
Why integrate with Google Drive?
Drive SDK opportunity

++
Extensive Reach
Put your app in front of millions of
users with billions of files

Effortless Integration
Get the best of Google Drive's sharing
capabilities, storage capacity and user
identity management so you can focus
on your app
Drive SDK features

Drive
•
•

Create, Read, List, Manage files through the API
Search, sharing and revisions

Drive Web UI
•

Open files and docs with your app directly from Drive
Integrating with Google Drive
Getting Started
Steps for integrating your app w/ Drive

Prerequisites:
• Create a project in the Google APIs Console
• Enable the Drive API
• Create OAuth 2.0 credentials

Integration steps:
• Auth with OAuth 2.0 [& OpenID Connect]
• Write code for opening / saving / managing files
OAuth 2.0
Introduction
A cool tool...

OAuth 2.0 Playground
Integrating with Google Drive
Handling Authorization for Web apps
Authorization
Using OAuth 2.0 - Redirecting users to the Grant screen
Python

decorator = OAuth2Decorator(client_id=settings.CLIENT_ID,
client_secret=settings.CLIENT_SECRET,
scope=settings.SCOPE,
user_agent='we-cloud')
class Documents(webapp.RequestHandler):
@decorator.oauth_required
def get(self):
user = users.get_current_user()
if user:
service = build('drive', 'v2', http=decorator.http())
Integrating with Google Drive
Interacting with Drive files
Instantiating the Drive service Object

Python

# Here is the Drive service
service = build('drive', 'v2', http=decorator.http())
Creating Folders

Python

folder = {
'title': self.request.get('project[name]'),
'mimeType': 'application/vnd.google-apps.folder'
}
created_folder = service.files().insert(body=folder).execute()
projectcollectionid = created_folder['id']
Creating Files

Python

mimetype = 'application/vnd.google-apps.' + self.request.get('doc[type]')
document = {
'title': self.request.get('doc[name]'),
'mimeType': mimetype
}
if projectcollectionid:
document['parents'] = [{'id': projectcollectionid}]
created_document = service.files().insert(body=document).execute()
resourceid = created_document['id']
Sharing Files

Python

#Share the file with other members
new_permission = {
'value': email,
'type': 'user',
'role': 'writer'
}
service.permissions().insert(fileId=fileid, body=new_permission).execute()
Searching for files
def retrieve_all_files(service,query):
result = []
page_token = None
param = {}
param['q'] = "fullText contains '"+ query + "'"
param['fields'] = "items(id,parents/id)"
while True:
try:
if page_token:
param['pageToken'] = page_token
files = service.files().list(**param).execute()
result.extend(files['items'])
page_token = files.get('nextPageToken')
if not page_token:
break
except errors.HttpError, error:

Python
Integrating with Google Drive
Adding the Drive Web-UI Integration
UI Integration - "Create"
UI Integration - "Open with"
Distribution - Chrome Web Store
Steps for adding Drive UI integration

Prerequisites:
• Create a Chrome Web Store listing

(Painful !)

• Install the application from the CWS
• Enable and configure the Drive SDK in the Google APIs Console

Integration steps:
• Support OAuth 2.0 server-side flow
• Read action and file ID from URL parameter
Passing context on open & create
What happens when somebody launches your app from Drive?
URL

https://www.yourapp.com/drive?code=<authorization code>&state=<JSON>

JSON

{
"action" : "create",
"parentId" : "0ADK06pfg"

Create actions

"action" : "open",
"ids" : ["0Bz0bd"]

Open actions

}
{

}
Integrating with Google Drive
The Google Picker
UI Integration - Embedded file picker
Embedding the picker
JS

google.setOnLoadCallback(createPicker);
google.load('picker', '1');
var view = new google.picker.View(google.picker.ViewId.DOCS);
view.setMimeTypes("image/png,image/jpeg,image/jpg");

function createPicker() {
picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.setAppId(YOUR_APP_ID)
.addView(view)
.setCallback(pickerCallback)
.build();
picker.setVisible(true);
Handling picker selections
JS

// A simple callback implementation.
function pickerCallback(data) {
if (data.action == google.picker.Action.PICKED) {
var fileId = data.docs[0].id;
alert('The user selected: ' + fileId);
}
}
Other features
Other Features / tips & tricks
•
•
•
•
•
•
•
•
•
•
•

Resumable upload & download
Indexable text
Search!
Conversions to native Google Documents
Export of native Google Documents in many formats
OCR
Revisions
List installed apps
Copy files, Trash files, Touch files
User Permissions
Shortcuts
o Auto-generated MIME type
o Contentless
<Thank You!>
http://developers.google.com/drive

h.lagrid@gmail.com
Google Drive & Google Drive SDK

More Related Content

What's hot

Google drive powerpoint
Google drive powerpointGoogle drive powerpoint
Google drive powerpointCory Lincourt
 
Learn more about what google drive can do
Learn more about what google drive can doLearn more about what google drive can do
Learn more about what google drive can doAisha_78
 
What is google drive
What is google driveWhat is google drive
What is google driveLeAnn Waldie
 
Google drive
Google driveGoogle drive
Google driveSamraZain
 
10 Amazing Things You Could Do With Google Drive
10 Amazing Things You Could Do With Google Drive10 Amazing Things You Could Do With Google Drive
10 Amazing Things You Could Do With Google DrivePraveen Jose
 
Google drive & docs
Google drive & docsGoogle drive & docs
Google drive & docsUES
 
Slide presentation on introduction to google drive february 2014 revised again b
Slide presentation on introduction to google drive february 2014 revised again bSlide presentation on introduction to google drive february 2014 revised again b
Slide presentation on introduction to google drive february 2014 revised again bRita Ndagire Kizito
 
Almost all about Google Drive
Almost all about Google DriveAlmost all about Google Drive
Almost all about Google DrivePlusOrMinusZero
 
Beginner's Guide to Google Drive
Beginner's Guide to Google DriveBeginner's Guide to Google Drive
Beginner's Guide to Google Drivejanice almada
 
Introduction to Google Drive & Safe Assign
Introduction to Google Drive & Safe AssignIntroduction to Google Drive & Safe Assign
Introduction to Google Drive & Safe AssignGreg Quinlivan
 
Google Drive (for dummies)
Google Drive (for dummies)Google Drive (for dummies)
Google Drive (for dummies)Dom Cushnan
 
Google drive
Google driveGoogle drive
Google driveTeddmosby
 
Google drive &amp; docs
Google drive &amp; docsGoogle drive &amp; docs
Google drive &amp; docsrodolfo romo
 
Introduction to Google Drive API
Introduction to Google Drive APIIntroduction to Google Drive API
Introduction to Google Drive APIJomar Tigcal
 
Upload files and folders to Google Drive
Upload files and folders to Google DriveUpload files and folders to Google Drive
Upload files and folders to Google DriveBridgePaSchool
 
How To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbee
How To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbeeHow To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbee
How To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbeedigitalthinkingbee.com
 

What's hot (20)

Google drive powerpoint
Google drive powerpointGoogle drive powerpoint
Google drive powerpoint
 
Collaborative Tools and LinkedIn
Collaborative Tools and LinkedInCollaborative Tools and LinkedIn
Collaborative Tools and LinkedIn
 
Learn more about what google drive can do
Learn more about what google drive can doLearn more about what google drive can do
Learn more about what google drive can do
 
What is google drive
What is google driveWhat is google drive
What is google drive
 
Google drive
Google driveGoogle drive
Google drive
 
10 Amazing Things You Could Do With Google Drive
10 Amazing Things You Could Do With Google Drive10 Amazing Things You Could Do With Google Drive
10 Amazing Things You Could Do With Google Drive
 
Google drive & docs
Google drive & docsGoogle drive & docs
Google drive & docs
 
Slide presentation on introduction to google drive february 2014 revised again b
Slide presentation on introduction to google drive february 2014 revised again bSlide presentation on introduction to google drive february 2014 revised again b
Slide presentation on introduction to google drive february 2014 revised again b
 
Almost all about Google Drive
Almost all about Google DriveAlmost all about Google Drive
Almost all about Google Drive
 
Beginner's Guide to Google Drive
Beginner's Guide to Google DriveBeginner's Guide to Google Drive
Beginner's Guide to Google Drive
 
google drive
google drivegoogle drive
google drive
 
Introduction to Google Drive & Safe Assign
Introduction to Google Drive & Safe AssignIntroduction to Google Drive & Safe Assign
Introduction to Google Drive & Safe Assign
 
Google Drive (for dummies)
Google Drive (for dummies)Google Drive (for dummies)
Google Drive (for dummies)
 
Google drive presentation
Google drive presentationGoogle drive presentation
Google drive presentation
 
Google drive
Google driveGoogle drive
Google drive
 
Google drive &amp; docs
Google drive &amp; docsGoogle drive &amp; docs
Google drive &amp; docs
 
Google drive &amp; docs
Google drive &amp; docsGoogle drive &amp; docs
Google drive &amp; docs
 
Introduction to Google Drive API
Introduction to Google Drive APIIntroduction to Google Drive API
Introduction to Google Drive API
 
Upload files and folders to Google Drive
Upload files and folders to Google DriveUpload files and folders to Google Drive
Upload files and folders to Google Drive
 
How To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbee
How To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbeeHow To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbee
How To Use Google Docs & Share Files - Belinda Bagatsing - digitalthinkingbee
 

Viewers also liked

iOS Google Sign In
iOS Google Sign IniOS Google Sign In
iOS Google Sign Inapgeek
 
Keystone College Students’ Perceptions of Career Development and Use of Caree...
Keystone College Students’ Perceptions of Career Development and Use of Caree...Keystone College Students’ Perceptions of Career Development and Use of Caree...
Keystone College Students’ Perceptions of Career Development and Use of Caree...Joseph Croft
 
An Engineers Guide to the AWS Ruby SDK
An Engineers Guide to the AWS Ruby SDKAn Engineers Guide to the AWS Ruby SDK
An Engineers Guide to the AWS Ruby SDK😸 Richard Spindler
 
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsDreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsHormoz Tarevern
 
#MBLTdev: Разработка первоклассных SDK для Android (Twitter)
#MBLTdev: Разработка первоклассных SDK для Android (Twitter)#MBLTdev: Разработка первоклассных SDK для Android (Twitter)
#MBLTdev: Разработка первоклассных SDK для Android (Twitter)e-Legion
 
google drive and the google drive sdk
google drive and the google drive sdkgoogle drive and the google drive sdk
google drive and the google drive sdkfirenze-gtug
 
Facebook Python SDK - Introduction
Facebook Python SDK - IntroductionFacebook Python SDK - Introduction
Facebook Python SDK - IntroductionColin Su
 

Viewers also liked (8)

iOS Google Sign In
iOS Google Sign IniOS Google Sign In
iOS Google Sign In
 
Keystone College Students’ Perceptions of Career Development and Use of Caree...
Keystone College Students’ Perceptions of Career Development and Use of Caree...Keystone College Students’ Perceptions of Career Development and Use of Caree...
Keystone College Students’ Perceptions of Career Development and Use of Caree...
 
An Engineers Guide to the AWS Ruby SDK
An Engineers Guide to the AWS Ruby SDKAn Engineers Guide to the AWS Ruby SDK
An Engineers Guide to the AWS Ruby SDK
 
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsDreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
 
#MBLTdev: Разработка первоклассных SDK для Android (Twitter)
#MBLTdev: Разработка первоклассных SDK для Android (Twitter)#MBLTdev: Разработка первоклассных SDK для Android (Twitter)
#MBLTdev: Разработка первоклассных SDK для Android (Twitter)
 
google drive and the google drive sdk
google drive and the google drive sdkgoogle drive and the google drive sdk
google drive and the google drive sdk
 
An In-Depth Look at Junos Space SDK
An In-Depth Look at Junos Space SDKAn In-Depth Look at Junos Space SDK
An In-Depth Look at Junos Space SDK
 
Facebook Python SDK - Introduction
Facebook Python SDK - IntroductionFacebook Python SDK - Introduction
Facebook Python SDK - Introduction
 

Similar to Google Drive & Google Drive SDK

Ict google drive report
Ict google drive reportIct google drive report
Ict google drive reportSEANROMMEL
 
Integrate Google Drive with Google Apps Script
Integrate Google Drive with Google Apps ScriptIntegrate Google Drive with Google Apps Script
Integrate Google Drive with Google Apps ScriptArun Nagarajan
 
Powerful Google Cloud tools for your hack
Powerful Google Cloud tools for your hackPowerful Google Cloud tools for your hack
Powerful Google Cloud tools for your hackwesley chun
 
Google's serverless journey: past to present
Google's serverless journey: past to presentGoogle's serverless journey: past to present
Google's serverless journey: past to presentwesley chun
 
Exploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewExploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewwesley chun
 
Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloudwesley chun
 
Cloud computing
Cloud computingCloud computing
Cloud computingJo Esc
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...e-Legion
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIswesley chun
 
Cloud computing overview & Technical intro to Google Cloud
Cloud computing overview & Technical intro to Google CloudCloud computing overview & Technical intro to Google Cloud
Cloud computing overview & Technical intro to Google Cloudwesley chun
 
Google cloud platform
Google cloud platformGoogle cloud platform
Google cloud platformAnkit Malviya
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptwesley chun
 
Image archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google CloudImage archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google Cloudwesley chun
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_authlzongren
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...wesley chun
 
Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)
Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)
Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)Ido Green
 
CloudOps evening presentation from Google
CloudOps evening presentation from GoogleCloudOps evening presentation from Google
CloudOps evening presentation from GoogleAlistair Croll
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIsExploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIswesley chun
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloudwesley chun
 

Similar to Google Drive & Google Drive SDK (20)

google drive
google drivegoogle drive
google drive
 
Ict google drive report
Ict google drive reportIct google drive report
Ict google drive report
 
Integrate Google Drive with Google Apps Script
Integrate Google Drive with Google Apps ScriptIntegrate Google Drive with Google Apps Script
Integrate Google Drive with Google Apps Script
 
Powerful Google Cloud tools for your hack
Powerful Google Cloud tools for your hackPowerful Google Cloud tools for your hack
Powerful Google Cloud tools for your hack
 
Google's serverless journey: past to present
Google's serverless journey: past to presentGoogle's serverless journey: past to present
Google's serverless journey: past to present
 
Exploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewExploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overview
 
Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloud
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Cloud computing overview & Technical intro to Google Cloud
Cloud computing overview & Technical intro to Google CloudCloud computing overview & Technical intro to Google Cloud
Cloud computing overview & Technical intro to Google Cloud
 
Google cloud platform
Google cloud platformGoogle cloud platform
Google cloud platform
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 
Image archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google CloudImage archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google Cloud
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)
Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)
Entrepreneurship Tips With HTML5 & App Engine Startup Weekend (June 2012)
 
CloudOps evening presentation from Google
CloudOps evening presentation from GoogleCloudOps evening presentation from Google
CloudOps evening presentation from Google
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIsExploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloud
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Google Drive & Google Drive SDK

  • 1.
  • 2. Google Drive and the Google Drive SDK Building Drive apps Abdelhalim Lagrid Google Developer Group, Algiers 1
  • 3. Introduction : One of Cloud google’s products : lunched in 2012 ..known by Google Drive API .
  • 4. What is Google Drive? Yea, some marketing :) 2222
  • 5. Access Anywhere Google Drive is everywhere you are -- on the web, in your home, at the office, and on the go. So wherever you are, your stuff is just...there. Ready to go, ready to share. Install it on: PC, Mac, Android, iOS
  • 6. Store your files in a safe place Things happen. Your phone goes for a swim. Your laptop takes an infinite snooze. No matter what happens to your devices, your files are safely stored in Google Drive.
  • 7. Powerful search Google Drive can search keywords in your files -- even the text in pictures -- to help you quickly find what you're looking for.
  • 8. View anything When a coworker shares a file with you, you may not have the supported software on your computer. With Google Drive you can open and view over 35 file types directly in the browser.
  • 9. Access to a world of apps! Google Drive works with the apps that make you more efficient. Choose from a growing set of productivity applications, integrated right into your Drive.
  • 10. Google Drive SDK Why integrate with Google Drive?
  • 11. Drive SDK opportunity ++ Extensive Reach Put your app in front of millions of users with billions of files Effortless Integration Get the best of Google Drive's sharing capabilities, storage capacity and user identity management so you can focus on your app
  • 12. Drive SDK features Drive • • Create, Read, List, Manage files through the API Search, sharing and revisions Drive Web UI • Open files and docs with your app directly from Drive
  • 13. Integrating with Google Drive Getting Started
  • 14. Steps for integrating your app w/ Drive Prerequisites: • Create a project in the Google APIs Console • Enable the Drive API • Create OAuth 2.0 credentials Integration steps: • Auth with OAuth 2.0 [& OpenID Connect] • Write code for opening / saving / managing files
  • 16. A cool tool... OAuth 2.0 Playground
  • 17. Integrating with Google Drive Handling Authorization for Web apps
  • 18. Authorization Using OAuth 2.0 - Redirecting users to the Grant screen Python decorator = OAuth2Decorator(client_id=settings.CLIENT_ID, client_secret=settings.CLIENT_SECRET, scope=settings.SCOPE, user_agent='we-cloud') class Documents(webapp.RequestHandler): @decorator.oauth_required def get(self): user = users.get_current_user() if user: service = build('drive', 'v2', http=decorator.http())
  • 19. Integrating with Google Drive Interacting with Drive files
  • 20. Instantiating the Drive service Object Python # Here is the Drive service service = build('drive', 'v2', http=decorator.http())
  • 21. Creating Folders Python folder = { 'title': self.request.get('project[name]'), 'mimeType': 'application/vnd.google-apps.folder' } created_folder = service.files().insert(body=folder).execute() projectcollectionid = created_folder['id']
  • 22. Creating Files Python mimetype = 'application/vnd.google-apps.' + self.request.get('doc[type]') document = { 'title': self.request.get('doc[name]'), 'mimeType': mimetype } if projectcollectionid: document['parents'] = [{'id': projectcollectionid}] created_document = service.files().insert(body=document).execute() resourceid = created_document['id']
  • 23. Sharing Files Python #Share the file with other members new_permission = { 'value': email, 'type': 'user', 'role': 'writer' } service.permissions().insert(fileId=fileid, body=new_permission).execute()
  • 24. Searching for files def retrieve_all_files(service,query): result = [] page_token = None param = {} param['q'] = "fullText contains '"+ query + "'" param['fields'] = "items(id,parents/id)" while True: try: if page_token: param['pageToken'] = page_token files = service.files().list(**param).execute() result.extend(files['items']) page_token = files.get('nextPageToken') if not page_token: break except errors.HttpError, error: Python
  • 25. Integrating with Google Drive Adding the Drive Web-UI Integration
  • 26. UI Integration - "Create"
  • 27. UI Integration - "Open with"
  • 29. Steps for adding Drive UI integration Prerequisites: • Create a Chrome Web Store listing (Painful !) • Install the application from the CWS • Enable and configure the Drive SDK in the Google APIs Console Integration steps: • Support OAuth 2.0 server-side flow • Read action and file ID from URL parameter
  • 30. Passing context on open & create What happens when somebody launches your app from Drive? URL https://www.yourapp.com/drive?code=<authorization code>&state=<JSON> JSON { "action" : "create", "parentId" : "0ADK06pfg" Create actions "action" : "open", "ids" : ["0Bz0bd"] Open actions } { }
  • 31. Integrating with Google Drive The Google Picker
  • 32. UI Integration - Embedded file picker
  • 33. Embedding the picker JS google.setOnLoadCallback(createPicker); google.load('picker', '1'); var view = new google.picker.View(google.picker.ViewId.DOCS); view.setMimeTypes("image/png,image/jpeg,image/jpg"); function createPicker() { picker = new google.picker.PickerBuilder() .enableFeature(google.picker.Feature.MULTISELECT_ENABLED) .setAppId(YOUR_APP_ID) .addView(view) .setCallback(pickerCallback) .build(); picker.setVisible(true);
  • 34. Handling picker selections JS // A simple callback implementation. function pickerCallback(data) { if (data.action == google.picker.Action.PICKED) { var fileId = data.docs[0].id; alert('The user selected: ' + fileId); } }
  • 36. Other Features / tips & tricks • • • • • • • • • • • Resumable upload & download Indexable text Search! Conversions to native Google Documents Export of native Google Documents in many formats OCR Revisions List installed apps Copy files, Trash files, Touch files User Permissions Shortcuts o Auto-generated MIME type o Contentless