SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
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 Effortless Integration
Put your app in front of millions of
users with billions of files
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
Python
Authorization
Using OAuth 2.0 - Redirecting users to the Grant screen
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
Python
Instantiating the Drive service Object
# Here is the Drive service
service = build('drive', 'v2', http=decorator.http())
Python
Creating Folders
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']
Python
Creating Files
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']
Python
Sharing Files
#Share the file with other members
new_permission = {
'value': email,
'type': 'user',
'role': 'writer'
}
service.permissions().insert(fileId=fileid, body=new_permission).execute()
Python
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:
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
JSON
Passing context on open & create
What happens when somebody launches your app from Drive?
{
"action" : "create",
"parentId" : "0ADK06pfg"
}
{
"action" : "open",
"ids" : ["0Bz0bd"]
}
URL
https://www.yourapp.com/drive?code=<authorization code>&state=<JSON>
Create actions
Open actions
Integrating with Google Drive
The Google Picker
UI Integration - Embedded file picker
JS
Embedding the picker
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);
JS
Handling picker selections
// 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
• 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
Other Features / tips & tricks
<Thank You!>
http://developers.google.com/drive
h.lagrid@gmail.com
google drive

Weitere ähnliche Inhalte

Was ist angesagt?

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
Google driveGoogle drive
Google driveTeddmosby
 
Lapin rs 2012 gd työpaja english
Lapin rs 2012 gd työpaja englishLapin rs 2012 gd työpaja english
Lapin rs 2012 gd työpaja englishJuha Paananen
 
Google docs m
Google docs m Google docs m
Google docs m u2903478
 
Extending Google Apps/Spreadsheet using Google Apps Script
Extending Google Apps/Spreadsheet using Google Apps ScriptExtending Google Apps/Spreadsheet using Google Apps Script
Extending Google Apps/Spreadsheet using Google Apps ScriptDipali Vyas
 
jQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FuturejQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FutureRichard Worth
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.jsVioletta Villani
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Hendrik Ebbers
 
Get More Out Of Google Docs
Get More Out Of Google DocsGet More Out Of Google Docs
Get More Out Of Google Docsbuggeen
 
Unlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerUnlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerRob Dodson
 
Session Slides from DEVintersection Europe
Session Slides from DEVintersection EuropeSession Slides from DEVintersection Europe
Session Slides from DEVintersection EuropeRick Van Rousselt
 
Introduction Dojo Toolkit & IBM Lotus Domino
Introduction Dojo Toolkit & IBM Lotus DominoIntroduction Dojo Toolkit & IBM Lotus Domino
Introduction Dojo Toolkit & IBM Lotus DominoRolf Kremer
 
Intro to jQuery @ Startup Institute
Intro to jQuery @ Startup InstituteIntro to jQuery @ Startup Institute
Intro to jQuery @ Startup InstituteRafael Gonzaque
 
Content Delivery at Aviary - NYC MUG 11/19/13
Content Delivery at Aviary - NYC MUG 11/19/13Content Delivery at Aviary - NYC MUG 11/19/13
Content Delivery at Aviary - NYC MUG 11/19/13MongoDB
 

Was ist angesagt? (16)

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
Google drive Google drive
Google drive
 
Google drive
Google driveGoogle drive
Google drive
 
Lapin rs 2012 gd työpaja english
Lapin rs 2012 gd työpaja englishLapin rs 2012 gd työpaja english
Lapin rs 2012 gd työpaja english
 
Google docs m
Google docs m Google docs m
Google docs m
 
Extending Google Apps/Spreadsheet using Google Apps Script
Extending Google Apps/Spreadsheet using Google Apps ScriptExtending Google Apps/Spreadsheet using Google Apps Script
Extending Google Apps/Spreadsheet using Google Apps Script
 
Mdst 3559-02-10-jquery
Mdst 3559-02-10-jqueryMdst 3559-02-10-jquery
Mdst 3559-02-10-jquery
 
jQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FuturejQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and Future
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)
 
Get More Out Of Google Docs
Get More Out Of Google DocsGet More Out Of Google Docs
Get More Out Of Google Docs
 
Unlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerUnlock the next era of UI design with Polymer
Unlock the next era of UI design with Polymer
 
Session Slides from DEVintersection Europe
Session Slides from DEVintersection EuropeSession Slides from DEVintersection Europe
Session Slides from DEVintersection Europe
 
Introduction Dojo Toolkit & IBM Lotus Domino
Introduction Dojo Toolkit & IBM Lotus DominoIntroduction Dojo Toolkit & IBM Lotus Domino
Introduction Dojo Toolkit & IBM Lotus Domino
 
Intro to jQuery @ Startup Institute
Intro to jQuery @ Startup InstituteIntro to jQuery @ Startup Institute
Intro to jQuery @ Startup Institute
 
Content Delivery at Aviary - NYC MUG 11/19/13
Content Delivery at Aviary - NYC MUG 11/19/13Content Delivery at Aviary - NYC MUG 11/19/13
Content Delivery at Aviary - NYC MUG 11/19/13
 

Ähnlich wie google drive

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
 
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
 
Cloud computing
Cloud computingCloud computing
Cloud computingJo Esc
 
Introduction to Google Drive API
Introduction to Google Drive APIIntroduction to Google Drive API
Introduction to Google Drive APIJomar Tigcal
 
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
 
Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloudwesley 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
 
CloudOps evening presentation from Google
CloudOps evening presentation from GoogleCloudOps evening presentation from Google
CloudOps evening presentation from GoogleAlistair Croll
 
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
 
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
 
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
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...e-Legion
 
Google Cloud for Data Crunchers - Strata Conf 2011
Google Cloud for Data Crunchers - Strata Conf 2011Google Cloud for Data Crunchers - Strata Conf 2011
Google Cloud for Data Crunchers - Strata Conf 2011Patrick Chanezon
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_authlzongren
 
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 Enterprise Cloud Platform - Resources & $2000 credit!
Google Enterprise Cloud Platform - Resources & $2000 credit!Google Enterprise Cloud Platform - Resources & $2000 credit!
Google Enterprise Cloud Platform - Resources & $2000 credit!BigDataCloud
 
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
 

Ähnlich wie google drive (20)

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
 
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
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Introduction to Google Drive API
Introduction to Google Drive APIIntroduction to Google Drive API
Introduction to Google Drive API
 
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
 
Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloud
 
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
 
CloudOps evening presentation from Google
CloudOps evening presentation from GoogleCloudOps evening presentation from Google
CloudOps evening presentation from Google
 
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
 
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
 
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...
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
 
Google Cloud for Data Crunchers - Strata Conf 2011
Google Cloud for Data Crunchers - Strata Conf 2011Google Cloud for Data Crunchers - Strata Conf 2011
Google Cloud for Data Crunchers - Strata Conf 2011
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
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 Enterprise Cloud Platform - Resources & $2000 credit!
Google Enterprise Cloud Platform - Resources & $2000 credit!Google Enterprise Cloud Platform - Resources & $2000 credit!
Google Enterprise Cloud Platform - Resources & $2000 credit!
 
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
 

Kürzlich hochgeladen

2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
OpenMetadata Community Meeting - 4th April, 2024
OpenMetadata Community Meeting - 4th April, 2024OpenMetadata Community Meeting - 4th April, 2024
OpenMetadata Community Meeting - 4th April, 2024OpenMetadata
 
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...kalichargn70th171
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxRemote DBA Services
 
What is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxWhat is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxTechnogeeks
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
oracle 23c new features for developer and dba
oracle 23c new features for developer and dbaoracle 23c new features for developer and dba
oracle 23c new features for developer and dbaRemote DBA Services
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Preparing BitVisor for Supporting Multiple Architectures
Preparing BitVisor for Supporting Multiple ArchitecturesPreparing BitVisor for Supporting Multiple Architectures
Preparing BitVisor for Supporting Multiple ArchitecturesAke Koomsin
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...
AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...
AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...Bert Jan Schrijver
 
Chapter -5 Agile Testing types and its examples.pptx
Chapter -5 Agile Testing types and its examples.pptxChapter -5 Agile Testing types and its examples.pptx
Chapter -5 Agile Testing types and its examples.pptxManishaPatil932723
 
Business Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisBusiness Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisDEEPRAJ PATHAK
 
Reliable from-source builds (Qshare 28 Nov 2023).pdf
Reliable from-source builds (Qshare 28 Nov 2023).pdfReliable from-source builds (Qshare 28 Nov 2023).pdf
Reliable from-source builds (Qshare 28 Nov 2023).pdfRalf Gommers
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdfAbdul salam
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Reviewjw364beach
 
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...OnePlan Solutions
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 

Kürzlich hochgeladen (20)

2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
OpenMetadata Community Meeting - 4th April, 2024
OpenMetadata Community Meeting - 4th April, 2024OpenMetadata Community Meeting - 4th April, 2024
OpenMetadata Community Meeting - 4th April, 2024
 
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptx
 
What is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxWhat is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docx
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
oracle 23c new features for developer and dba
oracle 23c new features for developer and dbaoracle 23c new features for developer and dba
oracle 23c new features for developer and dba
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Preparing BitVisor for Supporting Multiple Architectures
Preparing BitVisor for Supporting Multiple ArchitecturesPreparing BitVisor for Supporting Multiple Architectures
Preparing BitVisor for Supporting Multiple Architectures
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...
AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...
AmsterdamJUG April 2024 - Going serverless with Quarkus GraalVM native images...
 
Chapter -5 Agile Testing types and its examples.pptx
Chapter -5 Agile Testing types and its examples.pptxChapter -5 Agile Testing types and its examples.pptx
Chapter -5 Agile Testing types and its examples.pptx
 
Business Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisBusiness Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business Analysis
 
Reliable from-source builds (Qshare 28 Nov 2023).pdf
Reliable from-source builds (Qshare 28 Nov 2023).pdfReliable from-source builds (Qshare 28 Nov 2023).pdf
Reliable from-source builds (Qshare 28 Nov 2023).pdf
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdf
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
 
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 

google drive

  • 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 Effortless Integration Put your app in front of millions of users with billions of files 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. Python Authorization Using OAuth 2.0 - Redirecting users to the Grant screen 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. Python Instantiating the Drive service Object # Here is the Drive service service = build('drive', 'v2', http=decorator.http())
  • 21. Python Creating Folders 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. Python Creating Files 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. Python Sharing Files #Share the file with other members new_permission = { 'value': email, 'type': 'user', 'role': 'writer' } service.permissions().insert(fileId=fileid, body=new_permission).execute()
  • 24. Python 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:
  • 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. JSON Passing context on open & create What happens when somebody launches your app from Drive? { "action" : "create", "parentId" : "0ADK06pfg" } { "action" : "open", "ids" : ["0Bz0bd"] } URL https://www.yourapp.com/drive?code=<authorization code>&state=<JSON> Create actions Open actions
  • 31. Integrating with Google Drive The Google Picker
  • 32. UI Integration - Embedded file picker
  • 33. JS Embedding the picker 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. JS Handling picker selections // 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. • 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 Other Features / tips & tricks