ตัวอย่าง Google Data APIs
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คำเตือน: หน้านี้เป็นข้อมูลเกี่ยวกับ Google Data API ซึ่งเป็น API รุ่นเก่าของ Google โดยเกี่ยวข้องกับ API ที่แสดงอยู่ในไดเรกทอรี Google Data API เท่านั้น ซึ่ง API หลายรายการถูกแทนที่ด้วย API รุ่นใหม่กว่าแล้ว ดูข้อมูลเกี่ยวกับ API ใหม่ที่เฉพาะเจาะจงได้ในเอกสารประกอบของ API ใหม่ ดูข้อมูลเกี่ยวกับการให้สิทธิ์คำขอด้วย API เวอร์ชันใหม่กว่าได้ที่การตรวจสอบสิทธิ์และการให้สิทธิ์บัญชี Google
หน้านี้มีลิงก์และข้อมูลเกี่ยวกับโค้ดตัวอย่าง
เนื้อหา
- ตัวอย่าง JavaScript
- ตัวอย่าง JSON
- ตัวอย่างแกดเจ็ต
- ตัวอย่าง Java
- ตัวอย่าง.NET
- ภาษาอื่นๆ
ตัวอย่าง JavaScript
ไลบรารีไคลเอ็นต์ JavaScript
สามารถใช้จากเว็บเบราว์เซอร์เพื่อโต้ตอบกับ Base Data API, Blogger Data API,
Calendar Data API, Contacts Data API และ
Finance Data API
หมายเหตุ: เราได้นำตัวอย่างที่เคยอยู่ในส่วนนี้ออกแล้วเนื่องจากตัวอย่างดังกล่าวต้องใช้ API และ/หรือวิธีการตรวจสอบสิทธิ์ที่ไม่มีให้บริการอีกต่อไป
ตัวอย่าง JSON
ตัวอย่างเหล่านี้เป็นตัวอย่างที่ใช้งานจริง คลิกเพื่อดู ดูข้อมูลเพิ่มเติมได้ที่การใช้ JSON กับ Google Data API
Google ปฏิทิน
- กิจกรรมที่กำลังจะมาถึงจากปฏิทิน
- ตัวอย่างนี้แสดงการแสดงรายการกิจกรรมในปฏิทินที่กำลังจะมาถึงจาก Google ปฏิทินในหน้าเว็บโดยใช้รูปแบบเอาต์พุต JSON ที่ Calendar Data API มีให้
Blogger
- โพสต์ล่าสุดจาก Blogger
- ตัวอย่างนี้แสดงรายการโพสต์ล่าสุดจากบล็อกที่โฮสต์ใน Blogger Beta โดยใช้รูปแบบเอาต์พุต JSON ที่ API ข้อมูลของ Blogger มีให้
สเปรดชีต
- การอ่านข้อมูลสเปรดชีตของ Google
- ตัวอย่างนี้แสดงการแสดงข้อมูลจาก Google สเปรดชีตในหน้าเว็บโดยใช้รูปแบบเอาต์พุต JSON ที่จัดทำโดย Spreadsheet Data API
ตัวอย่างแกดเจ็ต
ดูข้อมูลเพิ่มเติมเกี่ยวกับการสร้างแกดเจ็ต Google Data API ได้ที่การสร้างแกดเจ็ตข้อมูล Google หรือเอกสารประกอบฉบับเต็มเรื่องการเขียนแกดเจ็ต OAuth
- แกดเจ็ต Blogger
- แกดเจ็ต YouTube
ตัวอย่าง Java
ตัวอย่างที่มาพร้อมกับไลบรารีของไคลเอ็นต์
ตัวอย่างเหล่านี้อยู่ในแพ็กเกจไลบรารีไคลเอ็นต์ Java ที่ดาวน์โหลดได้
ดูข้อมูลเพิ่มเติมได้ที่คู่มือสำหรับนักพัฒนาซอฟต์แวร์เกี่ยวกับไลบรารีของไคลเอ็นต์ Java หรือดาวน์โหลดไลบรารีของไคลเอ็นต์ Java
- java/sample/authsub/
- พร็อกซี GData AuthSub ที่ติดตั้งใช้งานโดยใช้ Java Servlet และไคลเอ็นต์ JavaScript ตัวอย่างที่เข้าถึงข้อมูลผ่านพร็อกซี
- java/sample/calendar/
- ไคลเอ็นต์แบบง่ายที่ทำการจัดการแบบฮาร์ดโค้ดหลายอย่างใน Google ปฏิทิน
- java/sample/codesarch/
- ไคลเอ็นต์บรรทัดคำสั่งเพื่อค้นหา Google Code Search Data API
- java/sample/spreadsheet/
- แอปตัวอย่างที่ใช้ Google Spreadsheet API
- java/sample/appsforyourdomain/
- ตัวอย่างแอปที่ใช้ G Suite API
- java/sample/blogger/
- แอปตัวอย่างที่ใช้ Blogger API
- java/sample/contacts/
- แอปตัวอย่างที่ใช้ Google Contacts API
- java/sample/docs/
- แอปตัวอย่างที่ใช้ Google Doclist API
- java/sample/gbase/
- แอปตัวอย่างที่ใช้ Google Base API
- java/sample/photos/
- แอปตัวอย่างที่ใช้ Picasa Web Album API
- java/sample/sidewiki/
- แอปตัวอย่างที่ใช้ Google Sidewiki API
- java/sample/webmastertools/
- ตัวอย่างแอปที่ใช้ Webmaster API
- java/sample/youtube/
- แอปตัวอย่างที่ใช้ YouTube API
- หน้า ASP ของ YouTubeSample
- ตัวอย่างการค้นหาและอัปโหลดวิดีโอโดยใช้ไลบรารีของไคลเอ็นต์
ตัวอย่าง .NET
ตัวอย่างที่มาพร้อมกับไลบรารีของไคลเอ็นต์
ตัวอย่างเหล่านี้อยู่ในแพ็กเกจไลบรารีของไคลเอ็นต์ .NET ที่ดาวน์โหลดได้ ดูข้อมูลเพิ่มเติมได้ที่คู่มือสำหรับนักพัฒนาซอฟต์แวร์เกี่ยวกับไลบรารีของไคลเอ็นต์ .NET หรือดาวน์โหลดไลบรารีของไคลเอ็นต์ .NET
- clients/cs/samples/blogger/
- แอปตัวอย่างที่ใช้ Blogger API
- clients/cs/samples/calendar/
- แอปตัวอย่างที่ใช้ Google Calendar Data API
- clients/cs/samples/spreadsheets/
- แอปตัวอย่างที่ใช้ Google Spreadsheets API
- clients/cs/samples/DocListUploader/
- อัปโหลดเอกสารไปยัง Google เอกสาร
- clients/cs/samples/DocListExporter/
- ส่งออกเอกสาร Google ในรูปแบบต่างๆ
- clients/cs/samples/PhotoBrowser/
- ตัวอย่างแอปที่ใช้ Picasa Web Album API
- clients/cs/samples/YouTubeSample/
- แอปตัวอย่างที่ใช้ YouTube API
- clients/cs/samples/appsforyourdomain/
- ตัวอย่างแอปที่ใช้ G Suite API
ตัวอย่างอื่นๆ
- โปรแกรมอัปเดตรายชื่อติดต่อ
- ตัวอย่าง WPF ที่แสดงวิธีอ่านและอัปเดตรายชื่อติดต่อโดยใช้ Contacts API
นอกจากนี้ยังมีไฟล์ .zip ด้วย
- ตัวต่อ PDF ของ Google เอกสาร
- ต่อไฟล์ PDF เข้าด้วยกันและอัปโหลดผลลัพธ์ไปยัง Google เอกสาร
นอกจากนี้ยังมีไฟล์ .zip ด้วย
ภาษาอื่นๆ
C++
- ตัวอย่าง Documents List API
- อนุญาตให้ผู้ใช้ดู อัปโหลด ลบ และค้นหาเอกสาร สเปรดชีต งานนำเสนอ และโฟลเดอร์ Google ของตน ตัวอย่างนี้
ยังแสดงฟังก์ชัน ACL ของ API โดยการแสดงรายชื่อผู้ใช้ที่มีสิทธิ์อ่าน/เขียนด้วย
Ruby
- DocList Manager
- ตัวอย่าง Ruby on Rails ที่ช่วยให้ผู้ใช้ดูและส่งออกเอกสารได้
กลับไปด้านบน
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eThis page focuses on Google's older Google Data APIs and provides links to relevant documentation for newer APIs.\u003c/p\u003e\n"],["\u003cp\u003eThe page offers various code samples in JavaScript, JSON, Gadget, Java, .NET, and other languages to showcase interactions with the APIs.\u003c/p\u003e\n"],["\u003cp\u003eMany previously available JavaScript samples have been removed due to reliance on outdated APIs or authentication methods.\u003c/p\u003e\n"],["\u003cp\u003eUsers can find bundled sample code within the downloadable Java and .NET client library packages.\u003c/p\u003e\n"],["\u003cp\u003eGoogle provides documentation and resources for creating Google Data API gadgets and using JSON with Google Data APIs.\u003c/p\u003e\n"]]],[],null,["# Google Data APIs Samples\n\n**Warning** : This page is about Google's older APIs, the Google Data APIs; it's relevant only to the APIs that are listed in the [Google Data APIs directory](/gdata/docs/directory), many of which have been replaced with newer APIs. For information about a specific new API, see the new API's documentation. For information about authorizing requests with a newer API, see [Google Accounts Authentication and Authorization](/accounts).\n\nThis page provides links and information about sample code.\n\nContents\n--------\n\n1. [JavaScript samples](#JavaScript)\n2. [JSON samples](#JSON)\n3. [Gadget samples](#Gadgets)\n4. [Java samples](#Java)\n5. [.NET samples](#NET)\n6. [Other languages](#OTHERLANGS)\n\nJavaScript samples\n------------------\n\nThe [JavaScript client library](/gdata/docs/js)\ncan be used from web browsers to interact with the [Base Data API](/base), [Blogger Data API](/blogger/docs/1.0/developers_guide_js),\n[Calendar Data API](/google-apps/calendar/v1/developers_guide_javascript), [Contacts Data API](/google-apps/contacts/v1/developers_guide_js), and\n[Finance Data API](/finance/docs/1.0/developers_guide_js).\n\n**Note**: The samples that were previously in this section have been removed because they relied on APIs and/or authentication methods that are no longer available.\n\nJSON samples\n------------\n\nThese are live samples; click to view them. For more information, see [Using JSON with Google Data APIs](/gdata/json).\n\n### Google Calendar\n\n[Upcoming events from Calendar](/gdata/samples/cal_sample)\n: This sample demonstrates displaying a list of upcoming calendar events from a Google Calendar on a web page using the JSON output format provided by the Calendar Data API.\n\n### Blogger\n\n[Recent posts from Blogger](/gdata/samples/blogger_sample)\n: This sample demonstrates displaying a list of recent posts from a blog hosted on Blogger Beta using the JSON output format provided by the Blogger Data API.\n\n### Spreadsheets\n\n[Reading Google Spreadsheets data](/gdata/samples/spreadsheet_sample)\n: This sample demonstrates displaying data from a Google Spreadsheet on a web page using the JSON output format provided by the Spreadsheet Data API.\n\nGadget samples\n--------------\n\nFor more information on creating Google Data API gadgets, see [Creating a Google Data Gadget](/gdata/articles/gdata_gadgets) or the full [Writing OAuth Gadgets](/gadgets/docs/oauth) documentation.\n\n[Blogger gadget](http://code.google.com/p/gdata-samples/source/browse/trunk/gadgets/blogger/blogger_gadget.xml)\n[YouTube gadget](http://gadget-doc-examples.googlecode.com/svn/trunk/opensocial-gadgets/oauth-test.xml)\n\nJava samples\n------------\n\n### Samples bundled with the client library\n\nThese samples can be found in the downloadable Java client library\npackage. For more information, see the [Java\nclient library developer's guide](/gdata/client-java), or [download the Java client library](//code.google.com/p/gdata-java-client/downloads/list).\n\n[java/sample/authsub/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/authsub)\n: GData AuthSub proxy, implemented using Java servlets; sample JavaScript client that accesses data through the proxy.\n\n[java/sample/calendar/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/calendar)\n: Simple client that performs several hardwired manipulations on a Google Calendar.\n\n[java/sample/codesarch/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/codesearch)\n: Command line client to query the Google Code Search data API.\n\n[java/sample/spreadsheet/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/spreadsheet)\n: Sample apps using Google Spreadsheet API.\n\n[java/sample/appsforyourdomain/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/appsforyourdomain)\n: Sample apps using G Suite API.\n\n[java/sample/blogger/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/blogger)\n: Sample apps using Blogger API.\n\n[java/sample/contacts/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/contacts)\n: Sample apps using Google Contacts API.\n\n[java/sample/docs/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs)\n: Sample apps using Google Doclist API.\n\n[java/sample/gbase/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/gbase)\n: Sample apps using Google Base API.\n\n[java/sample/photos/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/photos)\n: Sample apps using Picasa Web Album API.\n\n[java/sample/sidewiki/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/sidewiki)\n: Sample apps using Google Sidewiki API.\n\n[java/sample/webmastertools/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/webmastertools)\n: Sample apps using Webmaster API.\n\n[java/sample/youtube/](//code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/youtube)\n: Sample apps using YouTube API.\n\n[YouTubeSample ASP page](http://google-gdata.googlecode.com/svn/trunk/clients/cs/samples/YouTubeSample/)\n: Video search and upload sample using the client library.\n\n.NET samples\n------------\n\n### Samples bundled with the client library\n\nThese samples can be found in the downloadable .NET client library package. For more information, see the [.NET client library developer's guide](/gdata/client-cs), or [download the .NET client library](//code.google.com/p/google-gdata).\n\n[clients/cs/samples/blogger/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/blogger)\n: Sample apps using Blogger API.\n\n[clients/cs/samples/calendar/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/calendar)\n: Sample apps using Google Calendar Data API.\n\n[clients/cs/samples/spreadsheets/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/spreadsheets)\n: Sample apps using Google Spreadsheet API.\n\n[clients/cs/samples/DocListUploader/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/DocListUploader)\n: Uploads documents to Google Docs.\n\n[clients/cs/samples/DocListExporter/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/DocListExporter)\n: Exports Google Documents in various formats.\n\n[clients/cs/samples/PhotoBrowser/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/PhotoBrowser)\n: Sample apps using Picasa Web Album API.\n\n[clients/cs/samples/YouTubeSample/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/YouTubeSample)\n: Sample apps using YouTube API.\n\n[clients/cs/samples/appsforyourdomain/](//code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/appsforyourdomain)\n: Sample apps using G Suite API.\n\n### Other examples\n\n[Contacts Updater](//code.google.com/p/gdata-samples/source/browse/#svn/trunk/contacts/ContactsUpdater)\n: A WPF sample that demonstrates how to read and update your contacts using the Contacts API.\n A [.zip file](http://gdata-samples.googlecode.com/svn/trunk/contacts/ContactsUpdater/ContactsUpdater.zip) is also available.\n\n[Google Docs PDF Concatenator](//code.google.com/p/gdata-samples/source/browse/#svn/trunk/doclist/PdfConcatenate)\n: Concatenates PDF files together and uploads the result to Google Docs.\n A [.zip file](http://gdata-samples.googlecode.com/files/PdfConcatenate.zip) is also available.\n\nOther languages\n---------------\n\n### C++\n\n[Documents List API sample](//code.google.com/p/gdata-cpp-util/source/browse/trunk/doclist_sample.cc)\n: Allows users to view, upload, delete, and search their Google documents, spreadsheets, presentations, and folders. This sample\n also demonstrates the API's ACL functionality by listing the users who have read/write permissions.\n\n### Ruby\n\n[DocList Manager](//code.google.com/p/gdata-samples/source/browse/#svn/trunk/doclist/DocListManager)\n: Ruby on Rails sample that allows users to view and export documents.\n\n[Back to top](#top)"]]