Contoh Google Drive API
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Bagian ini memberikan contoh untuk Google Drive API.
Untuk video pengantar tentang Drive API, lihat koleksi video Drive API.
Google menghosting contoh berikut di GitHub. Anda dapat membuat fork repositori ini
dan menggunakan kode sebagai referensi untuk project Anda sendiri.
Google Picker
Contoh kode Google Picker menunjukkan cara menggunakan pemilih gambar atau halaman upload yang dapat dibuka pengguna dari tombol di aplikasi web.
Untuk melihat atau mendownload sumber, buka
Google Picker
di repositori GitHub.
Membuka dan menyimpan file dengan Quickeditor
Contoh kode Quickeditors ini menunjukkan cara membuka dan menyimpan file dengan
Drive API.
Setiap contoh khusus platform Drive mencerminkan satu aplikasi contoh: editor teks, yang disebut Quickeditor, yang dapat mengedit file Drive dengan jenis MIME text/*
. Versi web menerapkan dua kasus penggunaan Drive mendasar:
Alur untuk kedua kasus penggunaan serupa. Drive mengalihkan pengguna ke aplikasi setelah pengguna memilihnya dari menu buat atau menu konteks file dengan jenis MIME terdaftar.
Untuk melihat atau mendownload sumber, buka Drive
Quickeditors di repositori GitHub.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-29 UTC.
[null,null,["Terakhir diperbarui pada 2025-08-29 UTC."],[],[],null,["# Google Drive API samples\n\nThis section provides samples for Google Drive API.\n\nFor introductory videos about Drive API, see the [Drive API\nvideo library](/workspace/drive/api/guides/videos).\n\nGoogle hosts the following samples on GitHub. You can fork these repositories\nand use the code as a reference for your own projects.\n\nGoogle Picker\n-------------\n\nThe [Google Picker code sample](/workspace/drive/picker/guides/sample) shows how to use\nan image selector or upload page that users can open from a button in a web app.\n\nTo view or download the source, visit\n[Google Picker](https://github.com/googleworkspace/browser-samples/tree/main/drive/picker)\non the GitHub repository.\n\nOpen and save files with Quickeditors\n-------------------------------------\n\nThis Quickeditors code sample shows how to open and save files with the\nDrive API.\n\nEach of the Drive platform-specific examples reflects a single\nsample app: a text editor, called a Quickeditor, capable of editing\nDrive files with the MIME type `text/*`. The [web\nversion](https://github.com/googleworkspace/drive-quickeditors/tree/main/web)\nimplements two fundamental Drive use cases:\n\n- [Integrate with Drive UI's \"New\" button](/workspace/drive/api/guides/integrate-create)\n- [Integrate with Drive UI's \"Open with\" context menu](/workspace/drive/api/guides/integrate-open)\n\nThe flow for both use cases is similar. Drive redirects a user to\nthe app after the user selects it from the create menu or the context menu of a\nfile with a registered [MIME type](/workspace/drive/api/guides/mime-types).\n\nTo view or download the source, visit [Drive\nQuickeditors](https://github.com/googledrive/web-quickeditor) on the GitHub\nrepository.\n\nRelated topics\n--------------\n\n- [The Google Picker API](/workspace/drive/picker/guides/overview)\n- [Drive UI integration overview](/workspace/drive/api/guides/about-apps)"]]