ตัวอย่าง API ของ Google ไดรฟ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ส่วนนี้มีตัวอย่างสำหรับ Google Drive API
ดูวิดีโอเบื้องต้นเกี่ยวกับ Drive API ได้ที่ คลังวิดีโอ
Drive API
Google โฮสต์ตัวอย่างต่อไปนี้ใน GitHub คุณสามารถ Fork ที่เก็บเหล่านี้
และใช้โค้ดเป็นข้อมูลอ้างอิงสำหรับโปรเจ็กต์ของคุณเองได้
Google Picker
ตัวอย่างโค้ดของ Google Picker แสดงวิธีใช้ตัวเลือกรูปภาพหรือหน้าอัปโหลดที่ผู้ใช้เปิดได้จากปุ่มในเว็บแอป
หากต้องการดูหรือดาวน์โหลดแหล่งที่มา ให้ไปที่
Google Picker
ในที่เก็บ GitHub
เปิดและบันทึกไฟล์ด้วย Quickeditors
ตัวอย่างโค้ด Quickeditors นี้แสดงวิธีเปิดและบันทึกไฟล์ด้วย
Drive API
ตัวอย่างเฉพาะแพลตฟอร์มไดรฟ์แต่ละรายการแสดงถึงแอปตัวอย่างเดียว
ซึ่งเป็นโปรแกรมแก้ไขข้อความชื่อ Quickeditor ที่สามารถแก้ไข
ไฟล์ไดรฟ์ที่มีประเภท MIME text/*
เวอร์ชันเว็บ
รองรับ 2 กรณีการใช้งานพื้นฐานของไดรฟ์ ได้แก่
ขั้นตอนสำหรับกรณีการใช้งานทั้ง 2 แบบจะคล้ายกัน ไดรฟ์จะเปลี่ยนเส้นทางผู้ใช้ไปยัง
แอปหลังจากที่ผู้ใช้เลือกแอปจากเมนูสร้างหรือเมนูบริบทของ
ไฟล์ที่มี MIME ประเภทที่ลงทะเบียนไว้
หากต้องการดูหรือดาวน์โหลดแหล่งที่มา ให้ไปที่ Drive
Quickeditors ในที่เก็บ GitHub
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 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)"]]