Panduan Protokol

Google Sites API klasik memungkinkan aplikasi Anda mengakses, memublikasikan, dan mengubah konten dalam Situs Google. Selain itu, aplikasi Anda dapat meminta daftar aktivitas terbaru, mengambil riwayat revisi, serta mengunggah/mengunduh lampiran dan file.

Audiens

Dokumen ini mengasumsikan bahwa Anda memahami ide umum di balik protokol Google Data API.

Dokumen ini ditujukan untuk pemrogram yang ingin menulis aplikasi klien yang dapat berinteraksi dengan Google Sites. Panduan ini menyediakan serangkaian contoh interaksi API data dasar menggunakan XML/HTTP mentah, beserta penjelasannya. Setelah membaca dokumen ini, Anda dapat mempelajari lebih lanjut cara berinteraksi dengan API menggunakan library klien dengan membaca contoh khusus bahasa yang dapat ditemukan di panduan lain di menu navigasi sebelah kiri.

Untuk referensi materi dalam panduan ini, lihat panduan referensi.

Memberi otorisasi permintaan

Saat aplikasi Anda meminta data pengguna non-publik, aplikasi harus menyertakan token otorisasi. Token ini juga mengidentifikasi aplikasi Anda ke Google.

Tentang protokol otorisasi

Aplikasi Anda harus menggunakan OAuth 2.0 untuk mengizinkan permintaan. Tidak ada protokol otorisasi lain yang didukung. Jika aplikasi Anda menggunakan Login dengan Google, beberapa aspek otorisasi akan ditangani untuk Anda.

Mengizinkan permintaan dengan OAuth 2.0

Permintaan ke Google Sites Data API untuk data pengguna non-publik harus diizinkan oleh pengguna yang diautentikasi.

Detail proses otorisasi, atau "alur", untuk OAuth 2.0 bervariasi bergantung pada jenis aplikasi yang Anda tulis. Proses umum berikut berlaku untuk semua jenis aplikasi:

  1. Saat membuat aplikasi, Anda mendaftarkannya menggunakan Konsol Google API. Selanjutnya, Google menyediakan informasi yang akan Anda perlukan nanti, seperti ID klien dan rahasia klien.
  2. Aktifkan Google Sites Data API di Konsol API Google. (Jika API tidak tercantum di Konsol API, lewati langkah ini.)
  3. Saat memerlukan akses ke data pengguna, aplikasi Anda akan meminta cakupan akses tertentu kepada Google.
  4. Google menampilkan layar izin kepada pengguna, yang meminta mereka mengizinkan aplikasi Anda untuk meminta beberapa data.
  5. Jika pengguna menyetujui, Google akan memberikan token akses berumur singkat ke aplikasi Anda.
  6. Aplikasi Anda meminta data pengguna, dengan menambahkan token akses ke permintaan.
  7. Jika Google menentukan bahwa permintaan Anda dan token tersebut valid, data yang diminta akan ditampilkan.

Beberapa alur mencakup langkah tambahan, seperti penggunaan token refresh untuk memperoleh token akses baru. Informasi selengkapnya tentang alur untuk berbagai jenis aplikasi dapat dilihat di dokumentasi OAuth 2.0 Google.

Berikut adalah informasi cakupan OAuth 2.0 untuk Google Sites Data API:

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

Untuk meminta akses menggunakan OAuth 2.0, aplikasi Anda memerlukan informasi cakupan, serta informasi yang disediakan oleh Google saat Anda mendaftarkan aplikasi (seperti ID klien dan rahasia klien).

Kembali ke atas

Menentukan versi

Setiap permintaan yang Anda kirimkan ke Google Sites Data API harus menentukan versi 1.4. Untuk menentukan nomor versi, gunakan header HTTP GData-Version:

GData-Version: 1.4

Atau, jika tidak dapat menetapkan header HTTP, Anda dapat menentukan v=1.4 sebagai parameter kueri di URL. Namun, sebaiknya gunakan header HTTP jika memungkinkan.

Catatan: Library klien menyediakan header versi yang sesuai secara otomatis, jadi jangan gunakan parameter kueri v=1.4 saat Anda menggunakan library klien.

Kembali ke atas

Feed Situs

Feed situs dapat digunakan untuk mencantumkan Google Sites yang dimiliki pengguna atau izin lihatnya dimiliki pengguna, dan juga mengubah judul situs yang sudah ada. Untuk domain G Suite, domain ini juga dapat digunakan untuk membuat atau menyalin seluruh situs.

Mencantumkan situs

Untuk menampilkan daftar situs yang dapat diakses pengguna, kirim permintaan GET yang diautentikasi ke URL berikut:

https://sites.google.com/feeds/site/domainName
Parameter feedDeskripsi
domainName'site' atau domain dari domain yang dihosting G Suite Anda (misalnya example.com).

Respons akan berisi feed dengan daftar situs:

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>

Situs dicantumkan dalam urutan abjad.

Membuat situs baru

Catatan: Fitur ini hanya tersedia untuk domain G Suite.

Situs baru dapat disediakan dengan membuat POST HTTP ke feed situs, misalnya:

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>

Permintaan di atas akan membuat situs Google baru dengan tema 'slate' di domain G Suite example.com. URL situs tersebut adalah http://sites.google.com/a/example.com/source-site/.

Jika situs berhasil dibuat, server akan merespons dengan 201 Created. Entri respons akan berisi elemen yang ditambahkan oleh server, seperti link ke situs, link ke feed ACL situs, nama, judul, dan ringkasan situs.

<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>

Menyalin situs

Catatan: Fitur ini hanya tersedia untuk domain G Suite.

Situs yang sudah ada dapat diduplikasi dengan cara yang sama seperti membuat situs baru. Namun, dalam entri Atom permintaan POST, sertakan <link> dengan rel='source' yang mengarah ke feed situs situs yang akan disalin. Setiap situs yang telah disalin akan memiliki tautan ini. Berikut adalah contoh untuk menduplikasi situs:

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>

Permintaan di atas akan menyalin situs tersebut di http://sites.google.com/a/example.com/source-site/.

Poin penting:

  • Hanya situs dan template situs milik pengguna terautentikasi yang dapat disalin.
  • Template situs juga dapat disalin. Situs adalah template jika setelan "Publikasikan situs ini sebagai template" dicentang di halaman setelan Google Sites.
  • Anda dapat menyalin situs dari domain lain, dengan menunggu Anda terdaftar sebagai pemilik di situs sumber.

Memperbarui metadata situs

Untuk memperbarui judul atau ringkasan situs, kirim PUT HTTP ke link edit entri situs. Misalnya, contoh berikut akan memperbarui judul situs sebelumnya menjadi New Test Site2 dan deskripsinya menjadi 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>

Menambahkan Kategori

Catatan: Fitur ini hanya tersedia untuk domain G Suite.

G Suite untuk situs Domain Anda menyertakan metadata kategori yang berguna untuk mengategorikan situs dalam domain Anda. Untuk menambahkan atau memperbarui metadata kategori, kirim PUT HTTP ke link edit entri situs Anda yang menyertakan tag category. Lihat garis tebal di contoh berikut:

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>

Contoh ini mengedit situs yang ada dan menambahkan kategori "Situs Tim".

Anda juga dapat menambahkan beberapa kategori dengan menambahkan tag <category> tambahan. Lihat garis tebal di contoh berikut:

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>

Contoh ini menambahkan dua kategori: "Situs Tim" dan "Departemen Hukum"

Pemetaan alamat web

Pemetaan alamat web memungkinkan pengguna Sites memetakan domain mereka sendiri ke Situs Google. Misalnya, http://www.mydomainsite.com dapat digunakan sebagai pengganti http://sites.google.com/a/domain.com/mysite. Bergantung pada tempat situs dihosting, Anda dapat mengubah pemetaan alamat web situs secara manual. Lihat artikel pusat bantuan kami untuk informasi selengkapnya.

Mengambil pemetaan alamat web situs

Untuk menampilkan pemetaan alamat web untuk situs, ambil entri situs/feed dengan parameter 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>

Pemetaan yang ada akan ditampilkan sebagai link dengan rel='webAddressMapping'. Misalnya, pada contoh di atas ada tiga webAddressMapping yang mengarah ke http://sites.google.com/site/myOtherTestSite situs.

Memodifikasi pemetaan alamat web

Catatan: Semua operasi GET/POST/PUT harus menentukan parameter with-mappings=true saat menangani pemetaan alamat web. Jika parameter tidak ada, webAddressMapping tidak akan ditampilkan dalam entri situs (GET) atau dipertimbangkan saat memperbarui/menghapus pemetaan (PUT) dari entri.

Untuk menambahkan, memperbarui, atau menghapus pemetaan, cukup tentukan, ubah, atau hapus link tersebut saat membuat situs baru atau memperbarui metadata situs. Parameter with-mappings=true harus disertakan pada URI feed situs. Catatan: untuk memperbarui pemetaan alamat, Anda harus menjadi admin situs atau admin domain untuk situs yang dihosting G Suite.

Misalnya, permintaan di bawah ini memperbarui pemetaan http://www.mysitemapping.com ke http://www.my-new-sitemapping.com, dan menghapus http://www.mysitemapping2.com dengan membiarkan link keluar dari entri:

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>

Perhatikan, pemetaan alamat web juga dapat ditentukan pada saat membuat/menyalin situs.

Kembali ke atas

Feed Aktivitas

Anda dapat mengambil aktivitas terbaru (perubahan) Situs dengan mengambil feed aktivitas. Setiap entri dalam feed aktivitas berisi informasi tentang perubahan yang dilakukan pada Situs.

Untuk membuat kueri feed aktivitas, kirim HTTP GET ke URL feed aktivitas:

https://sites.google.com/feeds/activity/domainName/siteName
Parameter feedDeskripsi
domainName'site' atau domain dari domain yang dihosting G Suite Anda (misalnya example.com).
siteNameNama ruang web situs Anda; ditemukan di URL Situs (misalnya, myCoolSite).

Contoh permintaan dan respons:

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>

Catatan: Untuk mengakses feed ini, Anda harus menjadi kolaborator atau pemilik Situs. Klien Anda harus mengirim header Authorization yang benar dan merujuk token yang diperoleh dalam Mengizinkan permintaan.

Kembali ke atas

Feed Revisi

Untuk mengambil histori revisi untuk entri konten apa pun, kirim GET HTTP ke link revisi entri:

https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
Parameter feedDeskripsi
domainName'site' atau domain dari domain yang dihosting G Suite Anda (misalnya example.com).
siteNameNama ruang web situs Anda; ditemukan di URL Situs (misalnya, myCoolSite).

Guna menemukan link revisi untuk halaman/komentar/lampiran/listitem tertentu, ambil entri dari feed konten terlebih dahulu menggunakan CONTENT_ENTRY_ID-nya. Entri yang diambil akan berisi <atom:link> ke feed revisi. Contoh:

<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"/>

Contoh permintaan dan respons:

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>

Catatan: Untuk mengakses feed ini, Anda harus menjadi kolaborator atau pemilik Situs. Klien Anda harus mengirim header Authorization yang benar dan merujuk token yang diperoleh dalam Mengotorisasi permintaan.

Kembali ke atas

Feed Konten

Mengambil konten

Feed konten mencantumkan konten Sites saat ini. Kirim permintaan GET yang diautentikasi ke URL berikut:

https://sites.google.com/feeds/content/domainName/siteName
Parameter feedDeskripsi
domainName'site' atau domain dari domain yang dihosting G Suite Anda (misalnya example.com).
siteNameNama ruang web situs Anda; ditemukan di URL Situs (misalnya, myCoolSite).

Hasilnya adalah feed yang mencantumkan halaman pertama entri konten di Situs. Setiap entri dalam feed akan mewakili jenis entri konten yang berbeda, seperti webpage, filecabinet, attachment, comment, dll. Elemen <category scheme="http://schemas.google.com/g/2005#kind"> menentukan jenis entri. Lihat panduan referensi untuk mengetahui daftar nilai kind dukungan.

Catatan: Feed ini mungkin memerlukan atau tidak memerlukan autentikasi; bergantung pada izin berbagi Situs. Jika Situs tersebut non-publik, klien Anda harus mengirim header Authorization yang benar (seperti yang terlihat pada contoh di atas) dan merujuk token yang diperoleh dalam Mengizinkan permintaan.

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>

Catatan: Ini hanyalah beberapa hasil pertama. Untuk menjelajahi seluruh feed konten, ikuti link feed 'berikutnya':

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

Penjelasan tentang elemen umum pada Atom dapat dilihat di referensi Protokol Data Google. Elemen yang menyimpan pengukuran tertentu ke Sites API klasik dijelaskan di bawah ini. Entri jenis tertentu akan memiliki properti tambahan (tidak tercantum di bawah), sementara yang lain tidak. Misalnya, entri listitem mungkin memiliki elemen <gs:field>, sedangkan entri webpage tidak.

ElemenDeskripsi
<content ...>Teks dalam adalah isi HTML halaman. Untuk beberapa entri (misalnya lampiran), elemen ini akan berisi atribut src yang mengarah ke file.
<link rel="alternate" ...>Link ke halaman atau item di Google Sites.
<link rel="http://schemas.google.com/sites/2008#revision" ...>Atribut href mengarah ke feed revisi entri.
<link rel="http://schemas.google.com/sites/2008#parent" ...>Atribut href mengarah ke entri induk entri.
<link rel="http://schemas.google.com/sites/2008#template" ...>Atribut href mengarah ke halaman template entri.
<category scheme="http://schemas.google.com/g/2005#kind" ...>label adalah jenis entrinya.
<category term="http://schemas.google.com/g/2005#template" ...>label=template menandakan bahwa entri adalah template.
<gd:feedLink>Atribut href mengarah ke turunan dari induk entri.
<sites:pageName>Nama ruang web halaman; sesuai dengan nama di URL halaman.
<sites:revision>Nomor revisi saat ini.

Contoh kueri feed konten

Anda dapat menelusuri feed konten menggunakan beberapa parameter kueri Google Data API standar dan parameter khusus untuk Sites API klasik. Untuk mengetahui informasi lebih mendetail dan daftar lengkap parameter yang didukung, lihat Panduan Referensi.

Mengambil jenis entri tertentu

Untuk mengambil jenis entri tertentu saja, gunakan parameter kind. Contoh ini hanya menampilkan entri webpage:

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

Untuk menampilkan lebih dari satu jenis entri, pisahkan setiap kind dengan ','. Contoh ini menampilkan entri filecabinet dan listpage:

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

Atau, Anda dapat menggunakan format standar untuk kueri /-/category Data Google, bukan parameter kind:

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

Mengambil template halaman

Contoh ini hanya menampilkan template halaman:

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

Untuk menampilkan semua jenis entri dan menyertakan halaman template, gunakan:

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

Mengambil halaman berdasarkan jalur

Jika Anda mengetahui jalur relatif halaman dalam Situs Google, Anda dapat menggunakan parameter path untuk mengambil halaman tertentu tersebut. Contoh ini akan menampilkan halaman yang terletak di http://sites.google.com/site/siteName/path/to/the/page:

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

Mengambil semua entri pada halaman induk

Jika mengetahui ID entri halaman, Anda dapat menggunakan parameter parent untuk mengambil semua entri turunannya (jika ada):

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

Termasuk draf atau entri yang dihapus

Untuk menyertakan entri draf atau entri yang dihapus, gunakan parameter include-drafts atau include-deleted. Contoh ini mencakup entri draf di feed konten:

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

Penelusuran teks lengkap

Untuk menelusuri seluruh konten situs, gunakan parameter q untuk mengeluarkan penelusuran teks lengkap:

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

Kembali ke atas



Membuat Konten

Konten baru (halaman web, halaman daftar, halaman lemari file, halaman pengumuman, dll.) dapat dibuat dengan mengirimkan POST HTTP ke feed konten:

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

Untuk daftar jenis entri yang didukung, lihat parameter kind di Panduan Referensi.

Membuat item / halaman baru

Contoh ini membuat webpage baru pada level teratas Situs, menyertakan beberapa Xcode untuk isi halaman, dan menetapkan judul judul ke '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>

Jika berhasil, server merespons dengan 201 Created dan salinan entri.

Membuat item/halaman pada jalur URL kustom

Secara default, contoh sebelumnya akan dibuat di URL http://sites.google.com/domainName/siteName/new-webpage-title dan memiliki judul halaman 'Judul Halaman Web Baru'. Artinya, <atom:title> dinormalkan ke new-webpage-title untuk URL. Untuk menyesuaikan jalur URL halaman, Anda dapat menetapkan elemen <sites:pageName>.

Contoh ini membuat filecabinet baru dengan judul halaman 'File Storage', tetapi membuat halaman di bawah URL http://sites.google.com/domainName/siteName/files dengan menentukan elemen <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>

Server menggunakan aturan prioritas berikut untuk memberi nama jalur URL halaman:

  1. <sites:pageName>, jika ada. Harus memenuhi a-z, A-Z, 0-9, -, _.
  2. <atom:title>, tidak boleh null jika pageName tidak ada. Normalisasi adalah memangkas + menciutkan spasi kosong menjadi '-' dan menghapus karakter yang tidak cocok dengan a-z, A-Z, 0-9, -, _.

Misalnya, 'Custom_Page2' akan diterima oleh server.

Membuat sub-halaman

Untuk membuat subhalaman (turunan) di halaman induk, sertakan <link rel="http://schemas.google.com/sites/2008#parent"> dalam entri Atom baru Anda. Tetapkan atribut href link ke link mandiri entri induk.

Contoh ini membuat announcement baru dengan judul 'announcement', di halaman pengumuman induk dengan ID entri PARENT_ENTRY_ID. Isi Xcode untuk badan halaman juga termasuk:

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>

Template halaman

Membuat template halaman

Proses pembuatan template halaman sama dengan membuat item/halaman baru dan membuat subhalaman.Perbedaannya adalah penambahan category dengan istilah dan label yang ditetapkan masing-masing ke 'http://schemas.google.com/g/2005#template' dan 'template'.

Contoh ini membuat template webpage baru.

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>

Membuat halaman dari template

Serupa dengan membuat template halaman, Anda dapat membuat instance halaman baru dari template dengan menyertakan <link> dengan rel='http://schemas.google.com/sites/2008#template' yang mengarah ke link mandiri template halaman.

Contoh ini membuat halaman filecabinet baru dari template halaman yang ada yang menentukan lemari file.

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>

Catatan: Meskipun template menentukan <category>, menyertakan satu template dalam entri Anda tetap diperlukan. Perhatikan juga, jika Anda menyertakan elemen <content>, server akan menolaknya.

Mengupload file

Sama seperti di Google Sites, API ini memungkinkan Anda mengupload lampiran ke halaman lemari file dan halaman induk.

Untuk mengupload lampiran ke induk, kirim permintaan POST HTTP ke URL feed konten:

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

Isi POST harus berupa permintaan multibagian MIME, untuk menggabungkan konten file dengan <atom:entry> yang berisi metadata lampiran. <atom:entry> harus mereferensikan link mandiri entri induk, untuk menentukan tempat lampiran akan dibuat. Lihat Membuat subhalaman untuk informasi selengkapnya.

Mengupload lampiran

Berikut adalah contoh mengupload file PDF ke lemari file dengan ID PARENT_ENTRY_ID. Lampiran ini akan dibuat dengan judul 'File PDF' dan deskripsi (opsional), 'paket 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--

Jika upload berhasil, server akan merespons dengan 201 Created dan salinan entri lampiran yang baru dibuat.

Mengupload lampiran ke folder

Untuk mengupload lampiran ke folder yang ada di filecabinet, sertakan kategori dengan atribut 'term' yang ditetapkan ke nama folder:

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

Lampiran web

Lampiran web adalah jenis lampiran khusus. Pada dasarnya, {i>file<i} adalah tautan ke file lain di web yang dapat Anda tambahkan ke daftar lemari file Anda. Fitur ini serupa dengan metode unggahan 'Tambahkan file menurut URL' di UI Google Sites.

Catatan: Lampiran web hanya dapat dibuat di lemari file. Materi iklan tersebut tidak dapat diupload ke jenis halaman lain.

Contoh ini membuat webattachment pada lemari file yang direferensikan oleh ID FILECABINET_ENTRY_ID. Judul dan deskripsinya (opsional) masing-masing ditetapkan ke 'GoogleLogo' dan 'warna yang bagus'.

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 akan membuat link dalam lemari file pengguna yang mengarah ke gambar di 'http://www.google.com/images/logo.gif'.

Kembali ke atas



Memperbarui Konten

Metadata (judul, pageName, dll.) dan konten halaman dari setiap halaman dapat diedit dengan satu permintaan PUT ke link edit. Isi permintaan harus berisi entri Atom yang menjelaskan halaman yang diperbarui. Pengecualian untuk aturan ini adalah entri lampiran, yang berarti entri tersebut hanya dapat digunakan untuk memperbarui metadata lampiran. Untuk mengubah konten file yang dilampirkan, cukup sertakan data mentah sebagai isi permintaan PUT ke link edit-media lampiran. Anda juga dapat mengupdate metadata dan konten file yang dilampirkan sekaligus dengan menggunakan permintaan multibagian MIME.

Untuk menegaskan bahwa pembaruan Anda tidak menimpa perubahan klien lain, sertakan nilai ETag entri asli. Anda dapat melakukannya dengan memberikan nilai ETag di header If-Match HTTP, atau dengan menyertakan atribut gd:etag entri asli dalam entri yang diperbarui. Untuk menentukan nilai ETag entri asli, periksa atribut gd:etag elemen <entry>. Untuk entri media, ETag media mungkin tersedia dalam atribut gd:etag link edit-media.

Jika Anda ingin mengupdate entri, terlepas dari apakah orang lain telah mengupdatenya atau belum sejak Anda mengambilnya, gunakan If-Match: * dan jangan sertakan ETag. Untuk informasi selengkapnya tentang ETag, lihat panduan referensi API Data Google.

Memperbarui metadata atau konten html item

Untuk mengupdate metadata atau konten HTML entri, kirim PUT HTTP ke link edit entri.

Berikut adalah contoh pembaruan entri listpage (diwakili oleh ID-nya ENTRY_ID) dengan perubahan berikut:

  • Judul diubah menjadi 'Konten yang Diperbarui'
  • Konten HTML yang diperbarui
  • Judul kolom pertama dalam daftar telah diperbarui menjadi 'Pemilik'
  • Jalur URL halaman diubah oleh elemen <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="Decription"/>
    <gs:column index="C" name="Completed"/>
  </gs:data>
  <sites:pageName>newPagePath</sites:pageName>
</entry>

Catatan: Entri (seperti yang ditampilkan oleh server) akan berisi lebih banyak elemen daripada contoh di atas.

Mengganti konten lampiran

Di bawah ini adalah contoh penggantian konten lampiran, tetapi metadatanya tidak berubah. Karena permintaan berisi konten baru, link edit-media entri lampiran akan digunakan.

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 ...

Memperbarui metadata lampiran + konten

Berikut adalah contoh pembaruan metadata lampiran dan kontennya secara bersamaan. Nama lampiran akan diperbarui menjadi 'Judul Baru' dan isinya akan diganti dengan isi file .zip. Karena permintaan ini berisi konten file baru, link edit-media entri lampiran akan digunakan.

Perlu diperhatikan bahwa menyertakan ETag untuk metadata juga akan menyediakan If-Match implisit untuk konten media, karena setiap pembaruan pada konten media akan menyebabkan ETag metadata.

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

Kembali ke atas



Menghapus Konten

Untuk menghapus item dari Situs Google, ambil entri terlebih dahulu, lalu kirim permintaan DELETE ke URL edit entri. Ini adalah URL yang sama dengan yang digunakan saat memperbarui metadata atau konten html item.

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>

Jika entri berhasil dihapus, server merespons dengan HTTP 200 OK.

Jika ingin memastikan bahwa Anda tidak menghapus entri yang telah diubah oleh klien lain sejak Anda mengambilnya, sertakan header If-Match HTTP yang berisi nilai ETag entri asli. Anda dapat menentukan nilai ETag entri asli dengan memeriksa atribut gd:etag elemen <entry>.

Jika Anda ingin menghapus entri, terlepas dari apakah orang lain telah memperbaruinya atau belum sejak Anda mengambilnya, gunakan If-Match: * dan jangan sertakan ETag. (Dalam hal ini, Anda tidak perlu mengambil entri sebelum menghapusnya.)

Untuk informasi selengkapnya tentang ETag, lihat panduan referensi API Data Google.

Kembali ke atas



Mendownload Lampiran

Setelah memiliki entri lampiran, Anda dapat mendownload file dengan mengirimkan HTTP GET yang diautentikasi ke link src <content> entri. Contoh link konten PDF:

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

Kembali ke atas

Feed ACL

Ringkasan Izin Berbagi (ACL)

Setiap entri ACL dalam feed ACL mewakili peran akses entitas tertentu, baik pengguna, grup pengguna, domain, atau akses default (yang merupakan situs publik). Entri hanya akan ditampilkan untuk entitas yang memiliki akses eksplisit - satu entri akan ditampilkan untuk setiap alamat email di panel "Orang dengan Akses" di layar berbagi UI Google Sites. Dengan demikian, admin domain tidak akan ditampilkan, meskipun mereka memiliki akses implisit ke situs.

Peran

Elemen peran mewakili tingkat akses yang dapat dimiliki suatu entitas. Ada empat kemungkinan nilai elemen gAcl:role:

  • pembaca — pelihat (setara dengan akses hanya baca).
  • writer — seorang kolaborator (setara dengan akses baca/tulis).
  • pemilik — biasanya admin situs (setara dengan akses baca/tulis).

Cakupan

Elemen cakupan mewakili entitas yang memiliki tingkat akses ini. Ada lima kemungkinan jenis elemen gAcl:scope:

  • pengguna — nilai alamat email, misalnya "pengguna@gmail.com".
  • grup — alamat email Google Grup, mis. "grup@domain.com".
  • domain — nama domain G Suite, misalnya "domain.com".
  • undangan — pengguna yang telah diundang ke situs, namun belum ditambahkan ke ACL untuk situs tersebut. (Tidak tersedia jika gdata 1.3 atau yang lebih lama ditentukan.)
  • default — Hanya ada satu kemungkinan cakupan jenis "default", yang tidak memiliki nilai (misalnya <gAcl:scope type="default">). Cakupan khusus ini mengontrol akses yang dimiliki setiap pengguna secara default di situs publik.

Catatan: Domain tidak boleh memiliki nilai gAcl:role yang ditetapkan ke akses "pemilik". Domain hanya dapat menjadi pembaca atau penulis.

Tentang cakupan "undang".

API menampilkan cakupan undangan saat Anda menambahkan satu atau beberapa pengguna ke ACL yang belum memiliki akun Google. API menampilkan URL dengan token tersemat yang harus Anda berikan kepada pengguna yang diundang agar mereka dapat menerima undangan.

Metode undangan ini memungkinkan Anda mengundang pengguna non-Google tanpa mengetahui sebelumnya alamat email yang ingin mereka gunakan. Selama pengguna mengklik URL undangan dengan token yang disematkan, mereka dapat mendaftar untuk mendapatkan akses menggunakan alamat email apa pun yang mereka inginkan. Selain itu, beberapa pengguna dapat berpotensi menggunakan URL ini untuk menerima undangan, jadi ini berguna jika mengundang satu pengguna atau sekelompok pengguna.

Catatan: Cakupan "undangan" hanya tersedia di Gdata versi 1.4 dan yang lebih baru. Tindakan ini tidak akan berfungsi jika Anda secara eksplisit menetapkan 1.3 atau yang lebih rendah.

Mengambil feed ACL

Feed ACL dapat digunakan untuk mengontrol izin berbagi situs dan dapat diakses melalui URI berikut:

https://sites.google.com/feeds/acl/site/domainName/siteName
Parameter feedDeskripsi
domainName'site' atau domain dari domain yang dihosting G Suite Anda (misalnya example.com).
siteNameNama ruang web situs Anda; ditemukan di URL Situs (misalnya, myCoolSite).

Perlu diperhatikan bahwa setiap entri dalam feed situs berisi link ke feed ini:

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

Untuk mengambil izin berbagi situs, kirim dan HTTP GET ke URI feed ACL:

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

Server akan merespons dengan 200 OK dan feed entri 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>

Kembali ke atas

Berbagi situs

Feed ACL menerima permintaan GET, POST, dan PUT. Untuk memasukkan peran baru ke dalam feed ACL, cukup berikan permintaan POST ke feed ACL situs.

Catatan: ACL berbagi tertentu hanya dapat dilakukan jika domain dikonfigurasi untuk memberikan izin tersebut (misalnya, jika berbagi di luar domain untuk domain G Suite diaktifkan, dll.).

Contoh ini menambahkan kolaborator baru (penulis) ke situs:

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 dan entri baru akan ditampilkan setelah penyisipan berhasil:

<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>

Mengundang pengguna melalui cakupan "undang"

Jika Anda menambahkan pengguna yang tidak memiliki akun Google, API akan menampilkan URL yang harus Anda berikan kepada pengguna yang ingin diundang. Setelah mengklik URL, mereka akan dapat mengakses situs dengan login menggunakan akun yang ada, atau membuat akun baru.

Undangan yang berhasil akan menampilkan 201 Created dan entri baru yang menyertakan URL yang harus Anda teruskan ke pengguna:

<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>

Berbagi tingkat Grup dan Domain

Serupa dengan berbagi situs dengan satu pengguna, Anda dapat berbagi situs di seluruh domain grup Google atau G Suite. Nilai scope yang diperlukan tercantum di bawah.

Berbagi ke alamat email grup:

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

Berbagi ke seluruh domain:

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

Berbagi di tingkat domain hanya didukung untuk domain G Suite, dan hanya untuk domain tempat situs dihosting. Misalnya, http://sites.google.com/a/domain1.com/siteA hanya dapat membagikan seluruh Situs dengan domain1.com, bukan domain2.com. Situs yang tidak dihosting di domain G Suite (misalnya, http://sites.google.com/site/siteB) tidak dapat mengundang domain.

Mengubah izin berbagi

Untuk memperbarui entri ACL, ubah entri sesuai kebutuhan, lalu ajukan permintaan PUT HTTP ke link edit entri, yang berupa elemen <link>, dengan atribut 'rel' yang ditetapkan ke 'edit'. Untuk contoh sebelumnya, link tersebut adalah:

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

Cuplikan di bawah ini mengubah peran new_writer@gmail.com menjadi 'pembaca':

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>

Menghapus izin berbagi

Untuk menghapus izin bagi pengguna ini, berikan permintaan DELETE ke link edit yang sama dengan yang digunakan untuk permintaan 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>

Server akan merespons dengan 200 OK.

Kembali ke atas

Topik Khusus

Mengambil feed atau entri lagi

Jika ingin mengambil feed atau entri yang telah diambil sebelumnya, Anda dapat meningkatkan efisiensi dengan memberi tahu server untuk mengirim daftar atau entri hanya jika daftar atau entri tersebut telah berubah sejak terakhir kali Anda mengambilnya.

Untuk melakukan pengambilan kondisional ini, kirim permintaan GET HTTP yang menyertakan header If-None-Match HTTP. Di header, tentukan ETag daftar atau entri, yang dapat Anda temukan dalam atribut gd:etag elemen <feed> atau elemen <entry>.

Contoh penggunaan feed situs:

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

Saat menerima permintaan ini, server akan memeriksa apakah item yang Anda minta memiliki ETag yang sama dengan ETag yang ditentukan. Jika ETag cocok, artinya item tidak berubah, dan server akan menampilkan kode status HTTP 304 Not Modified atau kode status HTTP 412 Precodition Failed. Kedua kode status tersebut menunjukkan bahwa item yang telah Anda ambil adalah yang terbaru.

Jika ETag tidak sesuai, item tersebut telah dimodifikasi sejak terakhir kali Anda memintanya, dan server akan mengembalikan item tersebut.

Untuk informasi selengkapnya tentang ETag, lihat panduan referensi API Data Google.

Batch Processing

Permintaan batch memberi klien Anda kemampuan untuk menjalankan beberapa operasi dalam satu permintaan, daripada mengirimkan setiap operasi satu per satu.

Server akan melakukan perubahan yang diminta sebanyak mungkin dan menampilkan informasi status yang dapat Anda gunakan untuk mengevaluasi keberhasilan atau kegagalan setiap operasi. Untuk mengetahui detail lebih lanjut tentang batch processing di Google Data API, lihat Batch Processing dengan Google Data API

Setiap operasi dalam feed batch memiliki elemen <id>, kecuali untuk operasi penyisipan. Elemen ini sama dengan URL permintaan yang biasanya Anda gunakan saat memperbarui, menghapus, atau membuat kueri feed konten. Misalnya, jika Anda memperbarui hasil edit, tetapkan <id> ke link edit untuk entri yang dipermasalahkan. Hal ini digunakan untuk mengidentifikasi entri target. Entri baru tidak memiliki elemen <id> karena belum dibuat. Sebagai gantinya, Anda dapat menentukan nilai string dalam <batch:id>, yang akan ditampilkan dalam respons server dan digunakan untuk mencari entri yang sesuai.

Untuk membuat permintaan batch, buat feed batch, lalu kirim POST HTTP ke link batch feed:

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

Contoh di bawah ini menunjukkan cara membuat kueri, menyisipkan, memperbarui, dan menghapus entri halaman web:

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>

Feed yang ditampilkan akan berisi satu entri hasil untuk setiap operasi:

 
<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>

Kembali ke atas