คู่มือโปรโตคอล

Classic Google Sites API ช่วยให้แอปพลิเคชันของคุณเข้าถึง เผยแพร่ และแก้ไขเนื้อหาภายใน Google Sites แบบคลาสสิก ได้ นอกจากนี้ แอปพลิเคชันของคุณยังสามารถขอรายการกิจกรรมล่าสุด ดึงข้อมูลประวัติการแก้ไข และอัปโหลด/ดาวน์โหลดไฟล์แนบและไฟล์ได้ด้วย

กลุ่มเป้าหมาย

เอกสารนี้ถือว่าคุณเข้าใจแนวคิดทั่วไปเบื้องหลังโปรโตคอล Google Data API

เอกสารนี้มีไว้สำหรับโปรแกรมเมอร์ที่ต้องการเขียนแอปพลิเคชันไคลเอ็นต์ที่สามารถโต้ตอบกับ Google Sites ได้ โดยมีตัวอย่างชุดการโต้ตอบ Data API พื้นฐานที่ใช้ XML/HTTP ดิบพร้อมคำอธิบาย หลังจากอ่านเอกสารนี้แล้ว คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับการโต้ตอบกับ API โดยใช้ไลบรารีของไคลเอ็นต์ได้โดยอ่านตัวอย่างเฉพาะภาษาที่พบในคู่มืออื่นๆ ในแถบนำทางด้านซ้าย

ดูข้อมูลอ้างอิงของเนื้อหาในคู่มือนี้ได้ที่คู่มืออ้างอิง

การอนุญาตคำขอ

เมื่อแอปพลิเคชันขอข้อมูลผู้ใช้ที่ไม่ใช่ข้อมูลสาธารณะ แอปพลิเคชันจะต้องมีโทเค็นการให้สิทธิ์ โทเค็นดังกล่าวจะระบุตัวตนแอปพลิเคชันของคุณให้ Google ทราบด้วย

เกี่ยวกับโปรโตคอลการให้สิทธิ์

แอปพลิเคชันต้องใช้ OAuth 2.0 เพื่อให้สิทธิ์คำขอ ระบบไม่รองรับโปรโตคอลการให้สิทธิ์อื่นๆ หากแอปพลิเคชันใช้ลงชื่อเข้าใช้ด้วย Google ระบบจะจัดการการให้สิทธิ์บางส่วนแก่คุณ

การให้สิทธิ์คำขอด้วย OAuth 2.0

คำขอที่ส่งไปยัง Google Sites Data API สำหรับข้อมูลผู้ใช้ที่ไม่ใช่ข้อมูลสาธารณะจะต้องได้รับสิทธิ์จากผู้ใช้ที่ตรวจสอบสิทธิ์แล้ว

รายละเอียดของกระบวนการให้สิทธิ์หรือ "ขั้นตอน" ของ OAuth 2.0 จะแตกต่างกันไปโดยขึ้นอยู่กับประเภทของแอปพลิเคชันที่คุณเขียน แอปพลิเคชันทุกประเภทจะใช้กระบวนการทั่วไปต่อไปนี้

  1. เมื่อสร้างแอปพลิเคชัน คุณจะลงทะเบียนแอปได้โดยใช้คอนโซล Google API จากนั้น Google จะให้ข้อมูลที่คุณต้องใช้ในภายหลัง เช่น รหัสไคลเอ็นต์และรหัสลับไคลเอ็นต์
  2. เปิดใช้งาน Google Sites Data API ในคอนโซล Google API (หากไม่เห็น API ดังกล่าวในคอนโซล API ให้ข้ามขั้นตอนนี้ไป)
  3. เมื่อแอปพลิเคชันต้องการเข้าถึงข้อมูลผู้ใช้ แอปจะขอขอบเขตการเข้าถึงที่จำเป็นจาก Google
  4. Google จะแสดงหน้าจอขอคำยินยอมแก่ผู้ใช้เพื่อขอให้ผู้ใช้ให้สิทธิ์แอปพลิเคชันของคุณในการขอข้อมูลบางอย่างของผู้ใช้
  5. หากผู้ใช้อนุมัติ Google จะให้โทเค็นเพื่อการเข้าถึงที่มีอายุชั่วคราวแก่แอปพลิเคชันของคุณ
  6. แอปพลิเคชันขอข้อมูลผู้ใช้โดยแนบโทเค็นเพื่อการเข้าถึงไปกับคำขอ
  7. หาก Google ตัดสินว่าคำขอและโทเค็นของคุณถูกต้อง ระบบจะแสดงข้อมูลที่ขอ

บางกระบวนการจะมีขั้นตอนเพิ่มเติม เช่น การใช้โทเค็นการรีเฟรชเพื่อขอโทเค็นเพื่อการเข้าถึงใหม่ ดูข้อมูลอย่างละเอียดเกี่ยวกับกระบวนการของแอปพลิเคชันประเภทต่างๆ ได้ที่เอกสารประกอบเกี่ยวกับ OAuth 2.0 ของ Google

ข้อมูลขอบเขตของ OAuth 2.0 สำหรับ Google Sites Data API มีดังต่อไปนี้

https://sites.google.com/feeds/

หากต้องการขอสิทธิ์โดยใช้ OAuth 2.0 แอปพลิเคชันของคุณต้องมีข้อมูลขอบเขต รวมถึงข้อมูลที่ Google ให้คุณตอนลงทะเบียนแอปพลิเคชัน (เช่น รหัสไคลเอ็นต์และรหัสลับไคลเอ็นต์)

กลับไปด้านบน

การระบุเวอร์ชัน

ทุกคำขอที่คุณส่งไปยัง Google Sites Data API ควรระบุเวอร์ชัน 1.4 หากต้องการระบุหมายเลขเวอร์ชัน ให้ใช้ส่วนหัว HTTP ของ GData-Version ดังนี้

GData-Version: 1.4

หรือหากตั้งค่าส่วนหัว HTTP ไม่ได้ คุณสามารถระบุ v=1.4 เป็นพารามิเตอร์การค้นหาใน URL ได้ แต่เราขอแนะนำให้ใช้ส่วนหัว HTTP หากเป็นไปได้

หมายเหตุ: ไลบรารีของไคลเอ็นต์จะระบุส่วนหัวของเวอร์ชันที่เหมาะสมโดยอัตโนมัติ ดังนั้นอย่าใช้พารามิเตอร์การค้นหา v=1.4 เมื่อใช้ไลบรารีของไคลเอ็นต์

กลับไปด้านบน

ฟีดเว็บไซต์

ฟีดเว็บไซต์สามารถใช้เพื่อแสดงรายการ Google Sites ที่ผู้ใช้เป็นเจ้าของหรือมีสิทธิ์ดู และยังแก้ไขชื่อเว็บไซต์ที่มีอยู่ได้ด้วย สำหรับโดเมน G Suite คุณยังใช้สคริปต์เพื่อสร้างหรือคัดลอกทั้งเว็บไซต์ได้ด้วย

เว็บไซต์ที่แสดงข้อมูล

หากต้องการแสดงรายการเว็บไซต์ที่ผู้ใช้มีสิทธิ์เข้าถึง ให้ส่งคำขอ GET ที่ผ่านการตรวจสอบสิทธิ์แล้วไปยัง URL ต่อไปนี้

https://sites.google.com/feeds/site/domainName
พารามิเตอร์ฟีดคำอธิบาย
domainName"site" หรือโดเมนของโดเมนที่ฝากบริการของ G Suite (เช่น example.com)

การตอบกลับจะมีฟีดที่มีรายการเว็บไซต์ดังนี้

GET /feeds/site/domainName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
    xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
    xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/site/site</id>
<updated>2009-12-02T17:47:34.406Z</updated>
<title>Site</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/site/site"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
    href="https://sites.google.com/feeds/feeds/site/domainName"/>
<link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName"/>
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/?start-index=2"/>
<generator version="1" uri="http://sites.google.com/">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry gd:etag="W/&quot;CkUAQH4_eil7I2A9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/site/myTestSite</id>
  <updated>2009-12-01T01:17:21.042Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T01:17:21.042Z</app:edited>
  <title>myTestSite</title>
  <summary/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myTestSite/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/>
  <sites:siteName>myTestSite</sites:siteName>
  <sites:theme>default</sites:theme>
</entry>
<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Memories Site"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <sites:siteName>myOtherTestSite</sites:siteName>
  <sites:theme>iceberg</sites:theme>
</entry>
...
</feed>

เว็บไซต์จะแสดงตามลำดับตัวอักษร

การสร้าง Sites แบบใหม่

หมายเหตุ: ฟีเจอร์นี้ใช้ได้กับโดเมน G Suite เท่านั้น

คุณจัดสรร Sites แบบใหม่ได้โดยส่ง HTTP POST ไปยังฟีดเว็บไซต์ เช่น

POST /feeds/site/example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <title>Source Site</title>
  <summary>A new site to hold memories</summary>
  <sites:theme>slate</sites:theme>
</entry>

คำขอด้านบนจะสร้าง Google Sites แบบใหม่ด้วยธีม "กระดานชนวน" ภายใต้โดเมน G Suite example.com URL ของเว็บไซต์จะเป็น http://sites.google.com/a/example.com/source-site/

หากสร้างเว็บไซต์สำเร็จ เซิร์ฟเวอร์จะตอบกลับด้วย 201 Created รายการตอบกลับจะมีองค์ประกอบที่เซิร์ฟเวอร์เพิ่มเข้ามา เช่น ลิงก์ไปยังเว็บไซต์ ลิงก์ไปยังฟีด ACL ของเว็บไซต์ ชื่อเว็บไซต์ ชื่อ และสรุป

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>New Test Site</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/source-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <sites:siteName>source-site</sites:siteName>
  <sites:theme>slate</sites:theme>
</entry>

การคัดลอกเว็บไซต์

หมายเหตุ: ฟีเจอร์นี้ใช้ได้กับโดเมน G Suite เท่านั้น

คุณสามารถทำซ้ำเว็บไซต์ที่มีอยู่ได้ในลักษณะเดียวกับการสร้าง Sites แบบใหม่ อย่างไรก็ตาม ในรายการ Atom ของคำขอ POST ให้ใส่ <link> ที่มี rel='source' ซึ่งชี้ไปยังฟีดเว็บไซต์ของเว็บไซต์ที่จะคัดลอก เว็บไซต์ที่คัดลอกมาจะมีลิงก์นี้ ตัวอย่างการทำซ้ำเว็บไซต์มีดังนี้

POST /feeds/site/example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom">
  <link rel="http://schemas.google.com/sites/2008#source" type="application/atom+xml"
      href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <title>Copy of New Test Site</title>
  <summary>A newer site to hold memories</summary>
</entry>

คำขอด้านบนจะคัดลอกเว็บไซต์ที่ http://sites.google.com/a/example.com/source-site/

ประเด็นสำคัญ

  • คัดลอกได้เฉพาะเว็บไซต์และเทมเพลตเว็บไซต์ที่ผู้ใช้ที่ตรวจสอบสิทธิ์แล้วเป็นเจ้าของเท่านั้น
  • นอกจากนี้ คุณยังคัดลอกเทมเพลตเว็บไซต์ได้ด้วย เว็บไซต์จะเป็นเทมเพลตหากเลือกการตั้งค่า "เผยแพร่เว็บไซต์นี้เป็นเทมเพลต" ในหน้าการตั้งค่า Google Sites
  • คุณสามารถคัดลอกเว็บไซต์จากโดเมนอื่นได้ โดยต้องรอให้ระบบระบุว่าคุณเป็นเจ้าของในเว็บไซต์ต้นทาง

การอัปเดตข้อมูลเมตาของเว็บไซต์

หากต้องการอัปเดตชื่อหรือสรุปของเว็บไซต์ ให้ส่ง HTTP PUT ไปยังลิงก์ edit ของรายการเว็บไซต์ ตัวอย่างเช่น ตัวอย่างต่อไปนี้จะอัปเดตชื่อเว็บไซต์ก่อนหน้าเป็น New Test Site2 และคำอธิบายเป็น Newer description

PUT /feeds/site/example.com/source-site HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>New Test Site2</title>
  <summary>Newer description</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Category"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/source-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <sites:siteName>source-site</sites:siteName>
</entry>

การเพิ่มหมวดหมู่

หมายเหตุ: ฟีเจอร์นี้ใช้ได้กับโดเมน G Suite เท่านั้น

เว็บไซต์ G Suite สำหรับโดเมนของคุณมีข้อมูลเมตาของหมวดหมู่ซึ่งมีประโยชน์สำหรับการจัดหมวดหมู่เว็บไซต์ภายในโดเมนของคุณ หากต้องการเพิ่มหรืออัปเดตข้อมูลเมตาของหมวดหมู่ ให้ส่ง HTTP PUT ไปยังลิงก์ edit ของรายการเว็บไซต์ที่มีแท็ก category ดูบรรทัดที่เป็นตัวหนาในตัวอย่างต่อไปนี้

PUT /feeds/site/example.com/source-site HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>My Team website</title>
  <summary>This site contains contact information and a summary of major efforts our team owns</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Team Site"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/my-team-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/my-team-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <sites:siteName>my-team-site</sites:siteName>
</entry>

ตัวอย่างนี้จะแก้ไขเว็บไซต์ที่มีอยู่และเพิ่มหมวดหมู่ "เว็บไซต์ของทีม"

นอกจากนี้ คุณยังเพิ่มหลายหมวดหมู่ได้โดยการเพิ่มแท็ก <category> เพิ่มเติม ดูบรรทัดที่เป็นตัวหนาในตัวอย่างต่อไปนี้

PUT /feeds/site/example.com/my-team-site HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/my-team-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>My Team website</title>
  <summary>This site contains contact information and a summary of major efforts our team owns</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Team Site/">
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Legal Department/">
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/my-team-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/my-team-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <sites:siteName>my-team-site</sites:siteName>
</entry>

ตัวอย่างนี้จะเพิ่ม 2 หมวดหมู่ ได้แก่ "เว็บไซต์ทีม" และ "ฝ่ายกฎหมาย"

การแมปที่อยู่เว็บ

การแมปที่อยู่เว็บช่วยให้ผู้ใช้ Sites แมปโดเมนของตนเองกับ Google Sites ได้ เช่น คุณสามารถใช้ http://www.mydomainsite.com แทน http://sites.google.com/a/domain.com/mysite ได้ คุณสามารถแก้ไขการแมปที่อยู่เว็บของเว็บไซต์ด้วยตนเองได้ ทั้งนี้ขึ้นอยู่กับตำแหน่งที่โฮสต์เว็บไซต์ ดูข้อมูลเพิ่มเติมในบทความในศูนย์ช่วยเหลือ

กำลังดึงข้อมูลการแมปที่อยู่เว็บของเว็บไซต์

หากต้องการแสดงผลการแมปที่อยู่เว็บสำหรับเว็บไซต์ ให้ดึงข้อมูลรายการ/ฟีดเว็บไซต์ด้วยพารามิเตอร์ with-mappings=true ดังนี้

GET /feeds/site/domainName?with-mappings=true HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
    xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
    xmlns:thr="http://purl.org/syndication/thread/1.0">
...
<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel='webAddressMapping' href='http://www.mysitemapping.com'>
  <link rel='webAddressMapping' href='http://www.mysitemapping2.com'>
  <link rel='webAddressMapping' href='http://www.myothermapping.org'>
</entry>
...
</feed>

การแมปที่มีอยู่จะแสดงเป็น link ที่มี rel='webAddressMapping' ตัวอย่างเช่น ในตัวอย่างข้างต้นมี webAddressMapping 3 รายการที่ชี้ไปยังเว็บไซต์ http://sites.google.com/site/myOtherTestSite

การแก้ไขการแมปที่อยู่เว็บ

หมายเหตุ: การดำเนินการ GET/POST/PUT ทั้งหมดควรระบุพารามิเตอร์ with-mappings=true เมื่อทำงานกับการแมปที่อยู่เว็บ หากไม่มีพารามิเตอร์ ระบบจะไม่แสดงผล webAddressMapping ในรายการเว็บไซต์ (GET) หรือพิจารณาเมื่ออัปเดต/นำการแมป (PUT) ออกจากรายการ

หากต้องการเพิ่ม อัปเดต หรือลบการแมป เพียงระบุ เปลี่ยนแปลง หรือนำลิงก์ดังกล่าวออกเมื่อสร้าง Sites แบบใหม่หรืออัปเดตข้อมูลเมตาของเว็บไซต์ ต้องระบุพารามิเตอร์ with-mappings=true ใน URI ของฟีดเว็บไซต์ หมายเหตุ: หากต้องการอัปเดตการแมปที่อยู่ คุณต้องเป็นผู้ดูแลเว็บไซต์ หรือผู้ดูแลโดเมนในกรณีที่เป็นเว็บไซต์ที่โฮสต์โดย G Suite

ตัวอย่างเช่น คำขอด้านล่างจะอัปเดตการแมป http://www.mysitemapping.com เป็น http://www.my-new-sitemapping.com และนำ http://www.mysitemapping2.com ออกโดยไม่ใส่ลิงก์ในรายการ

PUT /feeds/site/domainName?with-mappings=true HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel='webAddressMapping' href='www.my-new-sitemapping.com'>
  <!-- missing mapping2 will be deleted -->
  <link rel='webAddressMapping' href='http://www.myothermapping.org'>
</entry>

โปรดทราบว่าคุณสามารถระบุการแมปที่อยู่เว็บได้ในขณะที่สร้าง/คัดลอกเว็บไซต์

กลับไปด้านบน

ฟีดกิจกรรม

คุณสามารถดึงข้อมูลกิจกรรมล่าสุด (การเปลี่ยนแปลง) ของเว็บไซต์ได้โดยการดึงข้อมูลฟีดกิจกรรม แต่ละรายการในฟีดกิจกรรมจะมีข้อมูลเกี่ยวกับการเปลี่ยนแปลงที่เกิดขึ้นกับเว็บไซต์

หากต้องการค้นหาฟีดกิจกรรม ให้ส่ง HTTP GET ไปยัง URL ของฟีดกิจกรรม ดังนี้

https://sites.google.com/feeds/activity/domainName/siteName
พารามิเตอร์ฟีดคำอธิบาย
domainName"site" หรือโดเมนของโดเมนที่ฝากบริการของ G Suite (เช่น example.com)
siteNameชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งอยู่ใน URL ของเว็บไซต์ (เช่น myCoolSite)

ตัวอย่างคำขอและการตอบกลับ

GET /feeds/activity/site/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">
<id>https://sites.google.com/feeds/activity/site/siteName</id>
<updated>2009-09-10T05:24:23.120Z</updated>
<title>Activity</title>
<link rel="alternate" type="text/html" href="http://sites.google.com/site/siteName/system/app/pages/recentChanges"/>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName"/>
<link rel="self" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU4GQ3szfSl7ImA9WxNRFUg.&quot;">
<id>https://sites.google.com/feeds/activity/site/siteName/940375996952876062</id>
<updated>2009-09-10T03:38:42.585Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#deletion" label="deletion"/>
<title>home</title>
<summary type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">User deleted <a href="http://sites.google.com/site/siteName/home">home</a>
</div>
</summary>
<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
  href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
<link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
  href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
<link rel="self" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName/940375996952876062"/>
<author>
  <name>User</name>
  <email>user@gmail.com</email>
</author>
</entry>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8DQn45fyl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/activity/site/siteName/7165439066235480082</id>
  <updated>2009-09-10T03:37:53.027Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/sites/2008#edit" label="edit"/>
  <title>home</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">User2 edited <a href="http://sites.google.com/site/siteName/home">home</a>
  </div>
  </summary>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
  <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/activity/site/siteName/7165439066235480082"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
</entry>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8AR3s4cSl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/activity/site/siteName/127448462987345884</id>
  <updated>2009-09-10T03:37:26.539Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/sites/2008#creation" label="creation"/>
  <title>home</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">User3 created <a href="http://sites.google.com/site/siteName/home">home</a>
  </div>
  </summary>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
  <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/activity/site/siteName/127448462987345884"/>
  <author>
    <name>User3</name>
    <email>user3@gmail.com</email>
  </author>
</entry>
</feed>

หมายเหตุ: คุณต้องเป็นผู้ทำงานร่วมกันหรือเจ้าของเว็บไซต์จึงจะเข้าถึงฟีดนี้ได้ ไคลเอ็นต์ต้องส่งส่วนหัว Authorization ที่ถูกต้องและอ้างอิงโทเค็นที่ได้รับในคำขอให้สิทธิ์

กลับไปด้านบน

ฟีดการแก้ไข

หากต้องการดึงข้อมูลประวัติการแก้ไขสำหรับรายการเนื้อหาใดๆ ให้ส่ง HTTP GET ไปยังลิงก์การแก้ไขของรายการนั้นๆ ดังนี้

https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
พารามิเตอร์ฟีดคำอธิบาย
domainName"site" หรือโดเมนของโดเมนที่ฝากบริการของ G Suite (เช่น example.com)
siteNameชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งอยู่ใน URL ของเว็บไซต์ (เช่น myCoolSite)

หากต้องการค้นหาลิงก์การแก้ไขสำหรับหน้า/ความคิดเห็น/ไฟล์แนบ/รายการที่ระบุ ให้ดึงข้อมูลรายการจากฟีดเนื้อหาโดยใช้ CONTENT_ENTRY_ID ก่อน รายการที่ดึงมาจะมี <atom:link> ไปยังฟีดการแก้ไข เช่น

<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>

ตัวอย่างคำขอและการตอบกลับ

GET /feeds/revision/domainName/siteName/CONTENT_ENTRY_ID HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID</id>
<updated>2009-09-10T04:33:35.337Z</updated>
<title>Revisions</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>
<link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry gd:etag="W/&quot;CU4GQmA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2</id>
  <updated>2009-09-10T03:38:42.045Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Home</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Latest content here</div>
  </content>
  <link rel="alternate" type="text/html"
    href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4f67c7&amp;rev1=2"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>home</sites:pageName>
  <sites:revision>2</sites:revision>
</entry>
<entry gd:etag="W/&quot;CU8DQ388eSl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1</id>
  <updated>2009-09-10T03:37:52.171Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Home</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Older content here</div>
  </content>
  <link rel="alternate" type="text/html"
    href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4bc7&amp;rev1=1"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>home</sites:pageName>
  <sites:revision>1</sites:revision>
</entry>
</feed>

หมายเหตุ: คุณต้องเป็นผู้ทำงานร่วมกันหรือเจ้าของเว็บไซต์จึงจะเข้าถึงฟีดนี้ได้ ไคลเอ็นต์ต้องส่งส่วนหัว Authorization ที่ถูกต้องและอ้างอิงโทเค็นที่ได้รับในการให้สิทธิ์คำขอ

กลับไปด้านบน

ฟีดเนื้อหา

กำลังดึงข้อมูลเนื้อหา

ฟีดเนื้อหาจะแสดงเนื้อหาปัจจุบันของ Sites ส่งคำขอ GET ที่ผ่านการตรวจสอบสิทธิ์ไปยัง URL ต่อไปนี้

https://sites.google.com/feeds/content/domainName/siteName
พารามิเตอร์ฟีดคำอธิบาย
domainName"site" หรือโดเมนของโดเมนที่ฝากบริการของ G Suite (เช่น example.com)
siteNameชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งอยู่ใน URL ของเว็บไซต์ (เช่น myCoolSite)

ผลลัพธ์ที่ได้คือฟีดที่แสดงรายการหน้าแรกของรายการเนื้อหาในเว็บไซต์ แต่ละรายการในฟีดจะแสดงรายการเนื้อหาประเภทต่างๆ เช่น webpage, filecabinet, attachment, comment เป็นต้น โดยองค์ประกอบ <category scheme="http://schemas.google.com/g/2005#kind"> จะกำหนดประเภทของรายการ ดูรายการค่า kind ที่รองรับได้ในคู่มืออ้างอิง

หมายเหตุ: ฟีดนี้อาจต้องมีการตรวจสอบสิทธิ์หรือไม่ก็ได้ ทั้งนี้ขึ้นอยู่กับสิทธิ์การแชร์ของเว็บไซต์ หากเว็บไซต์ไม่เป็นสาธารณะ ไคลเอ็นต์ต้องส่งส่วนหัว Authorization ที่ถูกต้อง (ดังที่เห็นในตัวอย่างด้านบน) และอ้างอิงโทเค็นที่ได้รับในการให้สิทธิ์คำขอ

GET /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
  xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
  xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
  xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/content/domainName/siteName</id>
<updated>2009-08-31T01:39:20.286Z</updated>
<title>Content</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName"/>
<link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName/batch""/>
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry gd:etag="W/&quot;Ck8GQXk7fil7ImA9WxNSFk0.&quot;">
  <id>https://sites.google.com/feeds/content/domainName/siteName/7322156894</id>
  <updated>2009-08-30T02:53:40.706Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-30T02:53:40.706Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Subpage</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Page html content here</div>
  </content>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/6492205817"/>
  <link rel="alternate" type="text"
      href="http://sites.google.com/site/siteName/subpage"/>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
      href="https://sites.google.com/feeds/revision/domainName/siteName/7322156894"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/7322156894"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/7322156894"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>subpage</sites:pageName>
  <sites:revision>5</sites:revision>
</entry>
<entry gd:etag="W/&quot;CkMBQH08fCl7ImA9WxNSFk0.&quot;">
  <id>https://sites.google.com/feeds/content/domainName/siteName/5930635231</id>
  <updated>2009-08-30T02:47:31.374Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-30T02:47:31.374Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#listitem" label="listpage"/>
  <title/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
      href="https://sites.google.com/feeds/revision/domainName/siteName/5930635231"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:revision>1</sites:revision>
  <gs:field index="A" name="Issue/Feature">Implement cool feature X</gs:field>
  <gs:field index="B" name="Priority">P2</gs:field>
  <gs:field index="C" name="Owner"/>
  <gs:field index="D" name="Resolved"/>
</entry>
<entry gd:etag="W/&quot;AkYHQ3ozcCl7ImA9WxJaE08.&quot;">
  <id>https://sites.google.com/feeds/content/domainName/siteName/1265948545471894517</id>
  <updated>2009-08-03T19:35:32.488Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-03T19:35:32.488Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/>
  <title>files</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Page html content here</div>
  </content>
  <link rel="alternate" type="text"
      href="https://sites.google.com/domainName/siteName/files"/>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
      href="https://sites.google.com/feeds/revision/domainName/siteName/12671894517"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/12671894517"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/12671894517"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <gd:feedLink href="httpn://sites.google.com/feeds/content/domainName/siteName?parent=12671894517"/>
  <sites:pageName>files</sites:pageName>
  <sites:revision>1</sites:revision>
</entry>
...
</feed>

หมายเหตุ: นี่เป็นเพียงผลลัพธ์ 2-3 รายการแรกเท่านั้น หากต้องการดูหน้าต่างๆ ในฟีดเนื้อหาทั้งหมด ให้ไปที่ลิงก์ "ถัดไป" ของฟีด ดังนี้

<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>

ดูคำอธิบายองค์ประกอบทั่วไปของ Atom ได้ที่ข้อมูลอ้างอิงโปรโตคอลข้อมูลของ Google องค์ประกอบที่มีความหมายเฉพาะสำหรับ API ของ Sites แบบคลาสสิกมีอธิบายไว้ด้านล่าง รายการประเภทบางรายการจะมีพร็อพเพอร์ตี้เพิ่มเติม (ไม่ได้ระบุไว้ด้านล่าง) ขณะที่รายการอื่นๆ จะไม่มี เช่น รายการ listitem อาจมีองค์ประกอบ <gs:field> ในขณะที่รายการ webpage ไม่มี

องค์ประกอบคำอธิบาย
<content ...>ข้อความด้านในคือเนื้อหา HTML ของหน้าเว็บ สำหรับบางรายการ (เช่น ไฟล์แนบ) องค์ประกอบนี้จะมีแอตทริบิวต์ src ที่ชี้ไปยังไฟล์
<link rel="alternate" ...>ลิงก์ไปยังหน้าหรือรายการใน Google Sites
<link rel="http://schemas.google.com/sites/2008#revision" ...>แอตทริบิวต์ href ชี้ไปยังฟีดการแก้ไขของรายการ
<link rel="http://schemas.google.com/sites/2008#parent" ...>แอตทริบิวต์ href ชี้ไปยังรายการระดับบนของรายการ
<link rel="http://schemas.google.com/sites/2008#template" ...>แอตทริบิวต์ href ชี้ไปยังหน้าเทมเพลตของรายการ
<category scheme="http://schemas.google.com/g/2005#kind" ...>label คือประเภทของรายการ
<category term="http://schemas.google.com/g/2005#template" ...>label=template ซึ่งหมายความว่ารายการดังกล่าวเป็นเทมเพลต
<gd:feedLink>แอตทริบิวต์ href ชี้ไปยังรายการย่อยของรายการหลักของรายการ
<sites:pageName>ชื่อ Webspace ของหน้า ซึ่งสอดคล้องกับชื่อใน URL ของหน้า
<sites:revision>หมายเลขการแก้ไขปัจจุบัน

ตัวอย่างการค้นหาฟีดเนื้อหา

คุณสามารถค้นหาฟีดเนื้อหาโดยใช้พารามิเตอร์การค้นหา Google Data API มาตรฐานบางรายการและพารามิเตอร์ที่เฉพาะเจาะจงสำหรับ Sites API แบบคลาสสิก ดูข้อมูลโดยละเอียดและรายการพารามิเตอร์ที่รองรับทั้งหมดได้ในคู่มืออ้างอิง

การดึงข้อมูลรายการบางประเภท

หากต้องการดึงข้อมูลเฉพาะรายการประเภทใดประเภทหนึ่ง ให้ใช้พารามิเตอร์ kind ตัวอย่างนี้จะแสดงผลเพียง webpage รายการเท่านั้น

GET /feeds/content/domainName/siteName?kind=webpage

หากต้องการแสดงผลรายการมากกว่า 1 ประเภท ให้คั่น kind แต่ละรายการด้วย "," ตัวอย่างนี้จะแสดงผลรายการ filecabinet และ listpage

GET /feeds/content/domainName/siteName?kind=filecabinet,listpage

หรือจะใช้รูปแบบมาตรฐานสําหรับการค้นหา Google Data /-/category แทนพารามิเตอร์ kind ก็ได้ ดังนี้

GET /feeds/content/domainName/siteName/-/filecabinet|listpage

กำลังเรียกข้อมูลเทมเพลตของหน้าเว็บ

ตัวอย่างนี้จะแสดงผลเพียง template หน้าเท่านั้น

GET /feeds/content/domainName/siteName/-/template

หากต้องการแสดงผลรายการทุกประเภทและรวมหน้า template ให้ใช้คำสั่งต่อไปนี้

GET /feeds/content/domainName/siteName/-/template|-template

การดึงข้อมูลหน้าเว็บตามเส้นทาง

หากทราบ Relative Path ของหน้าภายใน Google Sites คุณสามารถใช้พารามิเตอร์ path เพื่อดึงข้อมูลหน้าดังกล่าวได้ ตัวอย่างนี้จะแสดงหน้าเว็บที่ http://sites.google.com/site/siteName/path/to/the/page:

GET /feeds/content/domainName/siteName?path=/path/to/the/page

การดึงข้อมูลรายการทั้งหมดในหน้าหลัก

หากทราบรหัสรายการของหน้า คุณสามารถใช้พารามิเตอร์ parent เพื่อดึงข้อมูลรายการย่อยทั้งหมด (หากมี) ได้ดังนี้

GET /feeds/content/domainName/siteName?parent=CONTENT_ENTRY_ID

รวมถึงฉบับร่างหรือรายการที่ลบไปแล้ว

หากต้องการรวมรายการร่างหรือรายการที่ลบ ให้ใช้พารามิเตอร์ include-drafts หรือ include-deleted ตามลำดับ ตัวอย่างนี้มีรายการฉบับร่างในฟีดเนื้อหา

GET /feeds/content/domainName/siteName?include-drafts=true

การค้นหาข้อความแบบเต็ม

หากต้องการค้นหาเนื้อหาทั้งหมดของเว็บไซต์ ให้ใช้พารามิเตอร์ q เพื่อค้นหาข้อความแบบเต็ม ดังนี้

GET /feeds/content/domainName/siteName?q=Text%20I%20am%20looking%20for

กลับไปด้านบน



การสร้างเนื้อหา

คุณสร้างเนื้อหาใหม่ (หน้าเว็บ, หน้าลิสต์, หน้าตู้เก็บเอกสาร, หน้าประกาศ ฯลฯ) ได้โดยส่ง HTTP POST ไปยังฟีดเนื้อหา ดังนี้

https://sites.google.com/feeds/content/domainName/siteName

ดูรายการประเภทรายการที่รองรับได้ที่พารามิเตอร์ kind ในคู่มืออ้างอิง

การสร้างรายการ/หน้าใหม่

ตัวอย่างนี้จะสร้าง webpage ใหม่ภายใต้ระดับบนสุดของเว็บไซต์ โดยมี XHTML บางส่วนสำหรับเนื้อหาของหน้าเว็บ และตั้งชื่อส่วนหัวเป็น "New WebPage Title"

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 328
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>New Webpage Title</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div>
  </content>
</entry>

หากทำสำเร็จ เซิร์ฟเวอร์จะตอบกลับด้วย 201 Created และสำเนาของรายการ

การสร้างรายการ/หน้าเว็บภายใต้เส้นทาง URL ที่กำหนดเอง

โดยค่าเริ่มต้น ตัวอย่างก่อนหน้านี้จะสร้างขึ้นภายใต้ URL http://sites.google.com/domainName/siteName/new-webpage-title และมีส่วนหัวของหน้าเป็น "ชื่อหน้าเว็บใหม่" กล่าวคือ <atom:title> จะได้รับการปรับให้เป็นมาตรฐานเป็น new-webpage-title สำหรับ URL หากต้องการปรับแต่งเส้นทาง URL ของหน้าเว็บ คุณสามารถตั้งค่าองค์ประกอบ <sites:pageName> ได้

ตัวอย่างนี้จะสร้าง filecabinet ใหม่ที่มีส่วนหัวของหน้าเป็น "File Storage" แต่จะสร้างหน้าภายใต้ URL http://sites.google.com/domainName/siteName/files โดยระบุองค์ประกอบ <sites:pageName>

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 393
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/>
  <title>File Storage</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">A list of files is below.</div>
  </content>
  <sites:pageName>files</sites:pageName>
</entry>

เซิร์ฟเวอร์ใช้กฎลำดับความสำคัญต่อไปนี้ในการตั้งชื่อเส้นทาง URL ของหน้าเว็บ

  1. <sites:pageName> หากมี ต้องเป็นไปตาม a-z, A-Z, 0-9, -, _
  2. <atom:title> ต้องไม่เป็น Null หากไม่มี pageName การปรับมาตรฐานคือการตัด + ยุบช่องว่างเป็น "-" และนำอักขระที่ไม่ตรงกับ a-z, A-Z, 0-9, -, _ ออก

ตัวอย่างเช่น เซิร์ฟเวอร์จะยอมรับ "Custom_Page2"

การสร้างหน้าย่อย

หากต้องการสร้างหน้าย่อย (หน้าย่อย) ภายใต้หน้าหลัก ให้ใส่ <link rel="http://schemas.google.com/sites/2008#parent"> ในรายการ Atom ใหม่ ตั้งค่าแอตทริบิวต์ href ของลิงก์เป็นลิงก์เข้าเว็บเดิมของรายการระดับบน

ตัวอย่างนี้จะสร้าง announcement ใหม่ที่มีส่วนหัว "ประกาศ" ภายใต้หน้าประกาศหลักที่มีรหัสรายการ PARENT_ENTRY_ID นอกจากนี้ยังมีเนื้อหา XHTML สำหรับส่วนเนื้อหาของหน้าด้วย ดังนี้

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 470
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#announcement" label="announcement"/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
  <title>announcement</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div>
  </content>
</entry>

เทมเพลตของหน้าเว็บ

การสร้างเทมเพลตหน้าเว็บ

ขั้นตอนการสร้างเทมเพลตหน้าเว็บจะเหมือนกับการสร้างรายการ/หน้าเว็บใหม่และการสร้างหน้าย่อย โดยความแตกต่างคือการเพิ่ม category ที่มีคำและป้ายกำกับเป็น "http://schemas.google.com/g/2005#template" และ "template" ตามลำดับ

ตัวอย่างนี้จะสร้างเทมเพลต webpage ใหม่

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 464
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <category scheme="http://schemas.google.com/g/2005#labels" term="http://schemas.google.com/g/2005#template" label="template"/>
  <title>Webpage Template</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div>
  </content>
</entry>

การสร้างหน้าเว็บจากเทมเพลต

คุณสามารถสร้างหน้าใหม่จากเทมเพลตได้โดยใส่ <link> ที่มี rel='http://schemas.google.com/sites/2008#template' ซึ่งชี้ไปยังลิงก์เข้าเว็บเดิมของเทมเพลตหน้าเว็บ ซึ่งคล้ายกับการสร้างเทมเพลตหน้าเว็บ

ตัวอย่างนี้จะสร้างหน้า filecabinet ใหม่จากเทมเพลตหน้าเว็บที่มีอยู่ซึ่งกำหนดตู้เก็บเอกสาร

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 464
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/>
  <title>File Cabinet Page From Template</title>
  <link rel='http://schemas.google.com/sites/2008#template' type='application/atom+xml'
    href='https://sites.google.com/feeds/content/domainName/siteName/ENTRY_ID'/>
</entry>

หมายเหตุ: แม้ว่าเทมเพลตจะกำหนด <category> ไว้แล้ว แต่คุณยังคงต้องระบุ ใน รายการด้วย นอกจากนี้ โปรดทราบว่าหากคุณใส่องค์ประกอบ <content> เซิร์ฟเวอร์จะปฏิเสธ

การอัปโหลดไฟล์

เช่นเดียวกับใน Google Sites, API ช่วยให้คุณอัปโหลดไฟล์แนบไปยังหน้าจัดการไฟล์และหน้าหลักได้

หากต้องการอัปโหลดไฟล์แนบไปยังระดับบนสุด ให้ส่งคำขอ HTTP POST ไปยัง URL ของฟีดเนื้อหาต่อไปนี้

https://sites.google.com/feeds/content/domainName/siteName

เนื้อหา POST ควรเป็นคำขอแบบหลายส่วนของ MIME เพื่อรวมเนื้อหาไฟล์กับ <atom:entry> ที่มีข้อมูลเมตาของไฟล์แนบ <atom:entry> ควรจะอ้างอิงลิงก์เข้าเว็บเดิมของรายการหลัก เพื่อระบุตำแหน่งที่จะสร้างไฟล์แนบ ดูข้อมูลเพิ่มเติมได้ที่หัวข้อการสร้างหน้าย่อย

กำลังอัปโหลดไฟล์แนบ

ต่อไปนี้คือตัวอย่างการอัปโหลดไฟล์ PDF ไปยังหน้าจัดการไฟล์ที่มีรหัส PARENT_ENTRY_ID ระบบจะสร้างไฟล์แนบที่มีชื่อว่า "ไฟล์ PDF" และคำอธิบาย (ไม่บังคับ) ว่า "แพ็กเก็ต HR"

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 7221984
Content-Type: multipart/related; boundary=END_OF_PART
--END_OF_PART
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
          term="http://schemas.google.com/sites/2008#attachment" label="attachment"/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
        href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
  <title>PDF File</title>
  <summary>HR packet</summary>
</entry>

--END_OF_PART
Content-Type: application/pdf

... pdf contents here ...

--END_OF_PART--

หากอัปโหลดสำเร็จ เซิร์ฟเวอร์จะตอบกลับด้วย 201 Created และสำเนาของรายการไฟล์แนบที่สร้างขึ้นใหม่

การอัปโหลดไฟล์แนบไปยังโฟลเดอร์

หากต้องการอัปโหลดไฟล์แนบไปยังโฟลเดอร์ที่มีอยู่ใน filecabinet ให้ใส่หมวดหมู่ที่มีแอตทริบิวต์ "term" ที่ตั้งค่าเป็นชื่อโฟลเดอร์ ดังนี้

<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">

ไฟล์แนบในเว็บ

ไฟล์แนบในเว็บเป็นไฟล์แนบประเภทพิเศษ โดยพื้นฐานแล้ว ลิงก์เหล่านี้คือลิงก์ไปยังไฟล์อื่นๆ บนเว็บ ที่คุณสามารถเพิ่มลงในข้อมูล Filecabinet ได้ ฟีเจอร์นี้คล้ายกับวิธีการอัปโหลด "เพิ่มไฟล์ตาม URL" ใน UI ของ Google Sites

หมายเหตุ: คุณจะสร้างไฟล์แนบในเว็บได้ภายใต้หน้าจัดการไฟล์เท่านั้น โดยจะอัปโหลดไปยังหน้าประเภทอื่นๆ ไม่ได้

ตัวอย่างนี้จะสร้าง webattachment ภายใต้ Filecabinet ที่อ้างอิงโดยรหัส FILECABINET_ENTRY_ID ชื่อและคำอธิบาย (ไม่บังคับ) ของรูปภาพจะตั้งค่าเป็น "GoogleLogo" และ "สีสวย" ตามลำดับ

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Type: application/atom+xml
Content-Length: 531

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
          term="http://schemas.google.com/sites/2008#webattachment" label="webattachment"/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
        href="https://sites.google.com/feeds/content/domainName/siteName/FILECABINET_ENTRY_ID"/>
  <title>GoogleLogo</title>
  <summary>nice colors</summary>
  <content type="image/gif" src="http://www.google.com/images/logo.gif"></content>
</entry>

POST จะสร้างลิงก์ในตู้เก็บเอกสารของผู้ใช้ที่ชี้ไปยังรูปภาพที่ "http://www.google.com/images/logo.gif"

กลับไปด้านบน



กำลังอัปเดตเนื้อหา

คุณสามารถแก้ไขข้อมูลเมตา (ชื่อ, pageName ฯลฯ) และเนื้อหาของหน้าเว็บใดก็ได้ด้วยคำขอ PUT รายการเดียวไปยังลิงก์ edit เนื้อความของคำขอควรมีรายการ Atom ที่อธิบายหน้าเว็บที่อัปเดต ข้อยกเว้นของกฎนี้คือรายการไฟล์แนบ ซึ่งรายการดังกล่าวจะใช้ได้เฉพาะเพื่ออัปเดตข้อมูลเมตาของไฟล์แนบเท่านั้น หากต้องการเปลี่ยนเนื้อหาของไฟล์แนบ เพียงใส่ข้อมูลดิบเป็นเนื้อหาของคำขอ PUT ไปยังลิงก์ edit-media ของไฟล์แนบ นอกจากนี้ คุณยังอัปเดตทั้งข้อมูลเมตาและเนื้อหาไฟล์ที่แนบพร้อมกันได้โดยใช้คำขอ MIME แบบหลายส่วน

หากต้องการยืนยันว่าการอัปเดตของคุณไม่ได้เขียนทับการเปลี่ยนแปลงของไคลเอ็นต์รายอื่น ให้ใส่ค่า ETag ของรายการเดิม ซึ่งทำได้โดยระบุค่า ETag ในส่วนหัว HTTP If-Match หรือใส่แอตทริบิวต์ gd:etag ของรายการเดิมไว้ในรายการที่อัปเดต หากต้องการระบุค่า ETag ของรายการเดิม ให้ตรวจสอบแอตทริบิวต์ gd:etag ขององค์ประกอบ <entry> สำหรับรายการสื่อ ETag ของสื่ออาจมีอยู่ในแอตทริบิวต์ gd:etag ของลิงก์ edit-media

หากต้องการอัปเดตรายการไม่ว่าจะมีผู้อื่นอัปเดตรายการนั้นตั้งแต่คุณดึงข้อมูลมาหรือไม่ ให้ใช้ If-Match: * และไม่ต้องใส่ ETag ดูข้อมูลเพิ่มเติมเกี่ยวกับ ETag ได้ที่คู่มืออ้างอิง Google Data API

การอัปเดตข้อมูลเมตาหรือเนื้อหา HTML ของรายการ

หากต้องการอัปเดตข้อมูลเมตาหรือเนื้อหา HTML ของรายการ ให้ส่ง HTTP PUT ไปยังลิงก์ edit ของรายการ

ต่อไปนี้เป็นตัวอย่างการอัปเดตรายการ listpage (แสดงด้วยรหัส ENTRY_ID) โดยมีการเปลี่ยนแปลงต่อไปนี้

  • ชื่อมีการแก้ไขเป็น "เนื้อหาที่อัปเดต"
  • เนื้อหา HTML ที่อัปเดต
  • ส่วนหัวของคอลัมน์แรกของรายการจะอัปเดตเป็น "เจ้าของ"
  • เส้นทาง URL ของหน้าเว็บได้รับการแก้ไขโดยองค์ประกอบ <sites:pageName>
PUT /feeds/content/domainName/siteName/ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 816
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:gd="http://schemas.google.com/g/2005"
    gd:etag="W/&quot;CEEBRn0ymA9WxJWEUw.&quot;">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#listpage" label="listpage"/>
  <title>Updated Title</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Updated Content</div>
  </content>
  <gs:worksheet name="listpage"/>
  <gs:header row="1"/>
  <gs:data startRow="2">
    <gs:column index="A" name="Owner"/>
    <gs:column index="B" name="Description"/>
    <gs:column index="C" name="Completed"/>
  </gs:data>
  <sites:pageName>newPagePath</sites:pageName>
</entry>

หมายเหตุ: รายการ (ตามที่เซิร์ฟเวอร์แสดงผล) จะมีองค์ประกอบมากกว่าตัวอย่างด้านบน

การแทนที่เนื้อหาของไฟล์แนบ

ด้านล่างนี้เป็นตัวอย่างการแทนที่เนื้อหาของไฟล์แนบ แต่ปล่อยให้ข้อมูลเมตาไม่เปลี่ยนแปลง เนื่องจากคำขอมีเนื้อหาใหม่ ระบบจึงใช้ลิงก์ edit-media ของรายการไฟล์แนบ

PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 70581
Content-Type: application/msword

... doc contents here ...

การอัปเดตข้อมูลเมตา + เนื้อหาของไฟล์แนบ

ด้านล่างนี้เป็นตัวอย่างการอัปเดตทั้งข้อมูลเมตาและเนื้อหาของไฟล์แนบพร้อมกัน ชื่อไฟล์แนบจะอัปเดตเป็น "ชื่อใหม่" และเนื้อหาจะถูกแทนที่ด้วยเนื้อหาของไฟล์ .zip เนื่องจากคำขอมีเนื้อหาไฟล์ใหม่ ระบบจึงใช้ลิงก์ edit-media ของรายการไฟล์แนบ

โปรดทราบว่าการใส่ ETag สำหรับข้อมูลเมตาจะให้ If-Match โดยนัยสำหรับเนื้อหาสื่อด้วย เนื่องจากการอัปเดตเนื้อหาสื่อจะทำให้ ETag ของข้อมูลเมตาเปลี่ยนแปลง

PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Type: multipart/related; boundary="END_OF_PART"
--END_OF_PART
Content-Type: application/atom+xml

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq">
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
        href="https://sites.google.com/feeds/content/domainName/siteName/ATTACHMENT_ENTRY_ID"/>
  <title>New Title</title>
</entry>

--END_OF_PART
Content-Type: application/zip

... zip contents here ...

--END_OF_PART

กลับไปด้านบน



การลบเนื้อหา

หากต้องการนำรายการออกจาก Google Sites ก่อนอื่นให้ดึงข้อมูลรายการ จากนั้นส่งคำขอ DELETE ไปยัง URL edit ของรายการ ซึ่งเป็น URL เดียวกันกับที่ใช้เมื่ออัปเดตข้อมูลเมตาหรือเนื้อหา HTML ของรายการ

DELETE /feeds/content/domainName/siteName/ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
If-Match: <ETag or * here>

หากลบรายการเรียบร้อยแล้ว เซิร์ฟเวอร์จะตอบกลับด้วย HTTP 200 OK

หากต้องการตรวจสอบว่าคุณไม่ได้ลบรายการที่ไคลเอ็นต์รายอื่นเปลี่ยนแปลงไปตั้งแต่คุณเรียกข้อมูลมา ให้ใส่ส่วนหัว HTTP If-Match ที่มีค่า ETag ของรายการเดิม คุณสามารถกำหนดค่า ETag ของรายการเดิมได้โดยตรวจสอบแอตทริบิวต์ gd:etag ขององค์ประกอบ <entry>

หากต้องการลบรายการโดยไม่คำนึงว่ามีผู้อื่นอัปเดตรายการนั้นตั้งแต่คุณดึงข้อมูลมาหรือไม่ ให้ใช้ If-Match: * และไม่ต้องใส่ ETag (ในกรณีนี้ คุณไม่จำเป็นต้องดึงข้อมูลรายการดังกล่าวก่อนที่จะลบ)

ดูข้อมูลเพิ่มเติมเกี่ยวกับ ETag ได้ที่คู่มืออ้างอิง Google Data API

กลับไปด้านบน



กำลังดาวน์โหลดไฟล์แนบ

เมื่อมีรายการไฟล์แนบแล้ว คุณจะดาวน์โหลดไฟล์ได้โดยส่ง GET HTTP ที่ตรวจสอบสิทธิ์แล้วไปยังลิงก์ src <content> ของรายการ ตัวอย่างลิงก์เนื้อหาของ PDF

<content type="application/pdf"
  src="http://502377765-a-google-com-s-sites.googlegroups.com/feeds/media/content/domainName/siteName/678942036"/>

กลับไปด้านบน

ฟีด ACL

ภาพรวมของสิทธิ์การแชร์ (ACL)

รายการ ACL แต่ละรายการในฟีด ACL แสดงถึงบทบาทการเข้าถึงของเอนทิตีหนึ่งๆ ไม่ว่าจะเป็นผู้ใช้ กลุ่มผู้ใช้ โดเมน หรือการเข้าถึงเริ่มต้น (ซึ่งเป็นเว็บไซต์สาธารณะ) รายการจะแสดงเฉพาะเอนทิตีที่มีสิทธิ์เข้าถึงอย่างชัดแจ้ง โดยจะแสดง 1 รายการสำหรับอีเมลแต่ละรายการในแผง "ผู้ที่มีสิทธิ์เข้าถึง" ในหน้าจอการแชร์ของ UI ของ Google Sites ดังนั้น ระบบจะไม่แสดงผู้ดูแลระบบโดเมน แม้ว่าผู้ดูแลระบบจะมีสิทธิ์เข้าถึงเว็บไซต์โดยนัยก็ตาม

บทบาท

องค์ประกอบบทบาทแสดงถึงระดับการเข้าถึงที่เอนทิตีมีได้ องค์ประกอบ gAcl:role มีค่าที่เป็นไปได้ 4 ค่า ดังนี้

  • reader - ผู้ดู (เทียบเท่ากับสิทธิ์การเข้าถึงระดับอ่านอย่างเดียว)
  • writer - ผู้ทำงานร่วมกัน (เทียบเท่ากับสิทธิ์การอ่าน/เขียน)
  • owner — โดยปกติแล้วจะเป็นผู้ดูแลระบบเว็บไซต์ (เทียบเท่ากับสิทธิ์อ่าน/เขียน)

ขอบเขต

องค์ประกอบขอบเขตแสดงถึงเอนทิตีที่มีระดับการเข้าถึงนี้ องค์ประกอบ gAcl:scope มี 5 ประเภทที่เป็นไปได้ ดังนี้

  • user — ค่าอีเมล เช่น "user@gmail.com"
  • group — อีเมล Google Group เช่น "group@domain.com"
  • domain — ชื่อโดเมน G Suite เช่น "domain.com"
  • invite - ผู้ใช้ที่ได้รับเชิญให้เข้าเว็บไซต์ แต่ยังไม่ได้เพิ่มลงใน ACL ของเว็บไซต์ (ไม่พร้อมใช้งานหากระบุ gdata 1.3 หรือต่ำกว่า)
  • default - มีขอบเขตที่เป็นไปได้เพียงขอบเขตเดียวสำหรับประเภท "default" ซึ่งไม่มีค่า (เช่น <gAcl:scope type="default">) ขอบเขตนี้จะควบคุมสิทธิ์เข้าถึงที่ผู้ใช้มีโดยค่าเริ่มต้นในเว็บไซต์สาธารณะ

หมายเหตุ: โดเมนไม่สามารถมีค่า gAcl:role ที่ตั้งค่าเป็นสิทธิ์เข้าถึงระดับ "เจ้าของ" ได้ โดยจะเป็นได้เฉพาะผู้อ่านหรือผู้เขียนเท่านั้น

เกี่ยวกับขอบเขต "คำเชิญ"

API จะแสดงขอบเขตคำเชิญเมื่อคุณเพิ่มผู้ใช้ที่ยังไม่มีบัญชี Google อย่างน้อย 1 รายลงใน ACL API จะแสดงผล URL ที่มีโทเค็นแบบฝังซึ่งคุณต้องมอบให้แก่ผู้ใช้ที่ได้รับเชิญเพื่อให้ผู้ใช้ยอมรับคำเชิญได้

วิธีการเชิญนี้ช่วยให้คุณเชิญผู้ใช้ที่ไม่มีบัญชี Google ได้โดยไม่ต้องทราบล่วงหน้าว่าผู้ใช้ต้องการใช้อีเมลใด ตราบใดที่ผู้ใช้คลิก URL คำเชิญที่มีโทเค็นฝังอยู่ ผู้ใช้จะลงชื่อสมัครใช้เพื่อรับสิทธิ์เข้าถึงโดยใช้อีเมลใดก็ได้ที่ต้องการ นอกจากนี้ ผู้ใช้หลายคนอาจใช้ URL นี้เพื่อยอมรับคำเชิญได้ ดังนั้นวิธีนี้จึงมีประโยชน์หากเชิญผู้ใช้ 1 คนหรือกลุ่มผู้ใช้

หมายเหตุ: ขอบเขต "invite" ใช้ได้ใน gdata เวอร์ชัน 1.4 ขึ้นไปเท่านั้น วิธีนี้จะใช้ไม่ได้หากคุณระบุเวอร์ชัน 1.3 หรือต่ำกว่าอย่างชัดแจ้ง

กำลังดึงข้อมูลฟีด ACL

ฟีด ACL สามารถใช้เพื่อควบคุมสิทธิ์การแชร์ของเว็บไซต์ และเข้าถึงได้ผ่าน URI ต่อไปนี้

https://sites.google.com/feeds/acl/site/domainName/siteName
พารามิเตอร์ฟีดคำอธิบาย
domainName"site" หรือโดเมนของโดเมนที่ฝากบริการของ G Suite (เช่น example.com)
siteNameชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งอยู่ใน URL ของเว็บไซต์ (เช่น myCoolSite)

โปรดทราบว่ารายการแต่ละรายการในฟีดเว็บไซต์มีลิงก์ไปยังฟีดนี้

 <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>

หากต้องการเรียกข้อมูลสิทธิ์การแชร์ของเว็บไซต์ ให้ส่ง HTTP GET ไปยัง URI ของฟีด ACL ดังนี้

GET /feeds/acl/site/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

เซิร์ฟเวอร์จะตอบกลับด้วย 200 OK และฟีดของรายการ ACL ดังนี้

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
    xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
    xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/acl/site/domainName/siteName</id>
<updated>2009-12-03T22:01:05.963Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<title>Acl</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
    href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40gmail.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/>
  <gAcl:scope type="user" value="userA@google.com"/>
  <gAcl:role value="owner"/>
</entry>
<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/>
  <gAcl:scope type="user" value="userB@gmail.com"/>
  <gAcl:role value="writer"/>
</entry>
<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/>
  <gAcl:scope type="user" value="userC@gmail.com"/>
  <gAcl:role value="reader"/>
</entry>
...
</feed>

กลับไปด้านบน

การแชร์เว็บไซต์

ฟีด ACL ยอมรับคำขอ GET, POST และ PUT หากต้องการแทรกบทบาทใหม่ลงในฟีด ACL เพียงส่งคำขอ POST ไปยังฟีด ACL ของเว็บไซต์

หมายเหตุ: ACL การแชร์บางรายการอาจเป็นไปได้ก็ต่อเมื่อมีการกำหนดค่าโดเมนเพื่ออนุญาตสิทธิ์ดังกล่าว (เช่น หากเปิดใช้การแชร์ภายนอกโดเมนสำหรับโดเมน G Suite เป็นต้น)

ตัวอย่างนี้จะเพิ่มผู้ทำงานร่วมกัน (นักเขียน) รายใหม่ลงในเว็บไซต์

POST /feeds/acl/site/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://schemas.google.com/acl/2007#accessRule'/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='user' value='new_writer@example.com'/>
</entry>

ระบบจะแสดงผล 201 Created และรายการใหม่เมื่อแทรกสำเร็จ ดังนี้

<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='user' value='new_writer@example.com'/>
</entry>

การเชิญผู้ใช้ผ่านขอบเขต "invite"

หากคุณเพิ่มผู้ใช้ที่ไม่มีบัญชี Google, API จะแสดงผล URL ที่คุณต้องส่งให้ผู้ใช้ที่คุณต้องการเชิญ หลังจากคลิก URL แล้ว ผู้ใช้จะเข้าถึงเว็บไซต์ได้โดยลงชื่อเข้าใช้ด้วยบัญชีที่มีอยู่หรือสร้างบัญชีใหม่

คำเชิญที่สำเร็จจะแสดงผล 201 Created และรายการใหม่ที่มี URL ซึ่งคุณต้องส่งให้ผู้ใช้ ดังนี้

<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="http://schemas.google.com/sites/2008#invite" type="text/html"href="domainName/siteName?invite=inviteToken"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='invite' value='new_invite%40example.com'/>
</entry>

การแชร์ระดับกลุ่มและโดเมน

คุณสามารถแชร์เว็บไซต์กับกลุ่ม Google หรือโดเมน G Suite ได้เช่นเดียวกับการแชร์เว็บไซต์กับผู้ใช้รายเดียว ค่า scope ที่จำเป็นมีดังนี้

การแชร์ไปยังอีเมลกลุ่ม

<gAcl:scope type="group" value="group@example.com"/>

การแชร์กับทั้งโดเมน:

<gAcl:scope type="domain" value="example.com"/>

การแชร์ในระดับโดเมนรองรับเฉพาะโดเมน G Suite และเฉพาะโดเมนที่โฮสต์เว็บไซต์เท่านั้น ตัวอย่างเช่น http://sites.google.com/a/domain1.com/siteA จะแชร์ทั้งเว็บไซต์ได้กับ domain1.com เท่านั้น ไม่ใช่ domain2.com เว็บไซต์ที่ไม่ได้โฮสต์ในโดเมน G Suite (เช่น http://sites.google.com/site/siteB) จะเชิญโดเมนไม่ได้

การแก้ไขสิทธิ์การแชร์

หากต้องการอัปเดตรายการ ACL ให้แก้ไขรายการตามความจำเป็น และส่งคำขอ HTTP PUT ไปยังลิงก์ edit ของรายการ ซึ่งเป็นเพียงองค์ประกอบ <link> ที่ตั้งค่าแอตทริบิวต์ "rel" เป็น "edit" สำหรับตัวอย่างก่อนหน้านี้ ลิงก์ดังกล่าวคือ

<link rel='edit' type='application/atom+xml'
    href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>

ข้อมูลโค้ดด้านล่างจะเปลี่ยนบทบาทของ new_writer@gmail.com เป็น "ผู้อ่าน"

PUT /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
  <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/>
  <gAcl:role value='reader'/>
  <gAcl:scope type='user' value='new_writer@gmail.com'/>
</entry>

การนำสิทธิ์การแชร์ออก

หากต้องการนำสิทธิ์ของผู้ใช้รายนี้ออก ให้ส่งคำขอ DELETE ไปยังลิงก์ edit เดียวกันกับที่ใช้สำหรับคำขอ PUT ดังนี้

DELETE /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

เซิร์ฟเวอร์จะตอบกลับด้วย 200 OK

กลับไปด้านบน

หัวข้อพิเศษ

การดึงข้อมูลฟีดหรือรายการอีกครั้ง

หากต้องการดึงข้อมูลฟีดหรือรายการที่เคยดึงข้อมูลมาก่อน คุณสามารถเพิ่มประสิทธิภาพได้โดยบอกให้เซิร์ฟเวอร์ส่งรายการหรือรายการเฉพาะในกรณีที่มีการเปลี่ยนแปลงนับตั้งแต่ครั้งล่าสุดที่คุณดึงข้อมูล

หากต้องการดึงข้อมูลแบบมีเงื่อนไขในลักษณะนี้ ให้ส่งคำขอ HTTP GET ที่มีส่วนหัว HTTP If-None-Match ในส่วนหัว ให้ระบุ ETag ของรายการหรือรายการที่ป้อน ซึ่งคุณจะเห็นได้ในแอตทริบิวต์ gd:etag ขององค์ประกอบ <feed> หรือองค์ประกอบ <entry>

ตัวอย่างการใช้ฟีดเว็บไซต์

GET /feeds/site/domainName/myOtherTestSite/
GData-Version: 1.4
If-None-Match: W/"Ck8GQXk7fil7ImA9WxNSFk0."

เมื่อเซิร์ฟเวอร์ได้รับคำขอนี้ เซิร์ฟเวอร์จะตรวจสอบว่ารายการที่คุณขอมี ETag เดียวกับ ETag ที่คุณระบุหรือไม่ หาก ETag ตรงกัน แสดงว่ารายการไม่มีการเปลี่ยนแปลง และเซิร์ฟเวอร์จะแสดงรหัสสถานะ HTTP 304 Not Modified หรือรหัสสถานะ HTTP 412 Precodition Failed รหัสสถานะทั้ง 2 รายการนี้บ่งชี้ว่ารายการที่คุณดึงข้อมูลมาแล้วเป็นข้อมูลล่าสุด

หาก ETag ไม่ตรงกัน แสดงว่ามีการแก้ไขรายการนับตั้งแต่ที่คุณขอครั้งล่าสุด และเซิร์ฟเวอร์จะแสดงผลรายการดังกล่าว

ดูข้อมูลเพิ่มเติมเกี่ยวกับ ETag ได้ที่คู่มืออ้างอิง Google Data API

การประมวลผลแบบกลุ่ม

คำขอแบบกลุ่มช่วยให้ไคลเอ็นต์สามารถดำเนินการหลายอย่างในคำขอเดียว แทนที่จะส่งการดำเนินการแต่ละรายการแยกกัน

เซิร์ฟเวอร์จะทำการเปลี่ยนแปลงที่ขอให้มากที่สุดเท่าที่จะเป็นไปได้ และแสดงข้อมูลสถานะที่คุณสามารถใช้เพื่อประเมินความสำเร็จหรือความล้มเหลวของการดำเนินการแต่ละครั้ง ดูรายละเอียดเพิ่มเติมเกี่ยวกับการประมวลผลแบบกลุ่มใน Google Data API ได้ที่การประมวลผลแบบกลุ่มด้วย Google Data API

การดำเนินการทุกรายการในฟีดแบบกลุ่มจะมีองค์ประกอบ <id> ยกเว้นการดำเนินการแทรก องค์ประกอบนี้เหมือนกับ URL คำขอที่คุณใช้ตามปกติเมื่ออัปเดต ลบ หรือค้นหาฟีดเนื้อหา ตัวอย่างเช่น หากคุณกำลังอัปเดตการแก้ไข ให้ตั้งค่า <id> เป็นลิงก์ edit สำหรับรายการที่เป็นปัญหา ซึ่งใช้เพื่อระบุรายการเป้าหมาย รายการใหม่ไม่มีองค์ประกอบ <id> เนื่องจากยังไม่ได้สร้าง แต่คุณสามารถกำหนดค่าสตริงใน <batch:id> แทนได้ ซึ่งจะแสดงผลในการตอบกลับของเซิร์ฟเวอร์และใช้เพื่อค้นหารายการที่เกี่ยวข้อง

หากต้องการส่งคำขอแบบกลุ่ม ให้สร้างฟีดแบบกลุ่มและส่ง HTTP POST ไปยังลิงก์แบบกลุ่มของฟีด ดังนี้

<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/batch"/>

ตัวอย่างด้านล่างแสดงวิธีค้นหา แทรก อัปเดต และลบรายการหน้าเว็บ

POST /feeds/content/site/siteName/batch HTTP/1.1
Host: sites.google.com
Accept: */*
If-Match: *
GData-Version: 1.4
Authorization: <your authorization header here>

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"
      xmlns:gd="http://schemas.google.com/g/2005" xmlns:batch='http://schemas.google.com/gdata/batch'>
  <entry>
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
    <batch:operation type="query"/>
  </entry>
  <entry>
    <batch:id>1</batch:id>
    <batch:operation type='insert'/>
    <category scheme="http://schemas.google.com/g/2005#kind"
        term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
    <title>New Webpage1</title>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div>
    </content>
  </entry>
  <entry gd:etag="&quot;YDgpeyI.&quot;">
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id>
    <batch:operation type='update'/>
    <category scheme="http://schemas.google.com/g/2005#kind"
        term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
    <title>Updated Title for Webpage2</title>
    ...
    <batch:operaation type="update"/>
  </entry>
  <entry gd:etag="&quot;YassseyI.&quot;">
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id>
    <batch:operation type='delete'/>
  </entry>
</feed>

ฟีดที่แสดงผลจะมีรายการผลลัพธ์ 1 รายการสําหรับการดำเนินการแต่ละรายการ ดังนี้

 
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
<updated>2009-11-10T22:44:08.369Z</updated>
<title>Batch Feed</title>
<entry gd:etag="&quot;YDgpsdfeyI.&quot;">
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
  <published>2009-08-31T04:42:45.251Z</published>
  <updated>2009-10-25T22:46:13.729Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-25T22:46:13.671Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Page Title</title>
  ...
  <batch:status code="200" reason="Success"/>
  <batch:operation type="query"/>
</entry>
<entry gd:etag="&quot;YDsseyI.&quot;">
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID4</id>
  <published>2009-11-10T22:44:08.531Z</published>
  <updated>2009-11-10T22:44:08.560Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-10T22:44:08.531Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>New Webpage1</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
    <table cellspacing="0" class="sites-layout-name-one-column sites-layout-hbox">
      <tbody>
        <tr>
          <td class="sites-layout-tile sites-tile-name-content-1">
            <div>HTML body goes here</div>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</content>
...
<batch:id>1</batch:id>
<batch:status code="201" reason="Created"/>
<batch:operation type="insert"/>
</entry>
<entry gd:etag="&quot;YDkpeyI.&quot;">
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id>
  <updated>2009-11-10T22:44:09.296Z</updated>
  <title>Updated Title for Webpage2</title>
  ...
  <sites:pageName>updated-title-for-webpage2</sites:pageName>
  <sites:revision>5</sites:revision>
  <batch:status code="200" reason="Success"/>
  <batch:operation type="update"/>
</entry>
<entry>
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id>
  <title>Deleted</title>
  <content>Deleted</content>
  <batch:status code="200" reason="Success"/>
  <batch:operation type="delete"/>
</entry>
</feed>

กลับไปด้านบน