Klasik Google Sites API'si uygulamalarınızın bir Google Sites sitesi içindeki içeriğe erişmesine, bu içeriği yayınlamasına ve değiştirmesine olanak tanır. Ayrıca, uygulamanız son etkinlik listesini isteyebilir, düzeltme geçmişini getirebilir ve ekler ile dosyaları yükleyebilir/indirebilir.
Kitle
Bu dokümanda, Google Veri API'leri protokolünün ardındaki genel fikirleri anladığınız varsayılmaktadır.
Bu belge, Google Sites ile etkileşimde bulunabilecek istemci uygulamaları yazmak isteyen programcılar için hazırlanmıştır. Ham XML/HTTP kullanan temel veri API'si etkileşimlerine dair bir dizi örnek ve açıklamalar sağlar. Bu belgeyi okuduktan sonra, sol taraftaki gezinme çubuğundaki diğer kılavuzlarda bulunan dile özgü örnekleri okuyarak istemci kitaplıklarımızı kullanarak API ile etkileşim kurma hakkında daha fazla bilgi edinebilirsiniz.
Bu kılavuzdaki materyale referans için referans kılavuzuna bakın.
İstekleri yetkilendirme
Uygulamanız herkese açık olmayan kullanıcı verileri istediğinde, bir yetkilendirme jetonu içermelidir. Bu jeton ayrıca uygulamanızı Google'a tanıtır.
Yetkilendirme protokolleri hakkında
Uygulamanız, istekleri yetkilendirmek için OAuth 2.0 kullanmalıdır. Başka hiçbir yetkilendirme protokolü desteklenmez. Uygulamanız Google ile Oturum Açma özelliğini kullanıyorsa yetkilendirme işleminin bazı kısımları sizin adınıza gerçekleştirilir.
OAuth 2.0 kullanarak istekleri yetkilendirme
Herkese açık olmayan kullanıcı verileri için Google Sites Data API'ye gönderilen istekler, kimliği doğrulanmış bir kullanıcı tarafından yetkilendirilmelidir.
OAuth 2.0 ile yetkilendirme işleminin ("akış") ayrıntıları, yazdığınız uygulamanın türüne bağlı olarak değişiklik gösterir. Aşağıdaki genel işlem tüm uygulama türleri için geçerlidir:
- Uygulamanızı oluştururken Google API Konsolu'nu kullanarak kaydedersiniz. Ardından Google, daha sonra ihtiyaç duyacağınız bilgiler (ör. istemci kimliği ve istemci gizli anahtarı) sağlar.
- Google API Konsolu'nda Google Sites Data API'sını etkinleştirin. (API, API Konsolu'nda listelenmemişse bu adımı atlayın.)
- Uygulamanız kullanıcı verilerine erişmesi gerektiğinde Google'dan belirli bir erişim kapsamı ister.
- Google, kullanıcıya uygulamanızı kullanıcının verilerinden bazılarını istemeye yetkilendirmesi için bir onay ekranı gösterir.
- Kullanıcı onaylarsa Google, uygulamanıza kısa süreli bir erişim jetonu verir.
- Uygulamanız, erişim jetonunu isteğe ekleyerek kullanıcı verileri için istekte bulunur.
- Google, isteğinizin ve jetonun geçerli olduğuna kanaat getirirse istenen verileri döndürür.
Bazı akışlarda başka adımlar da yer alır. Örneğin, yeni erişim jetonları almak için yenileme jetonları kullanmak. Farklı uygulama türlerine yönelik akışlar hakkında ayrıntılı bilgi için Google'ın OAuth 2.0 dokümanlarına bakın.
Google Sites Data API'si için OAuth 2.0 kapsam bilgileri aşağıda verilmiştir:
https://sites.google.com/feeds/
Uygulamanızın OAuth 2.0 kullanarak erişim isteğinde bulunabilmesi için hem kapsam bilgilerine hem de uygulamanızı kaydederken Google tarafından sağlanan bilgilere (ör. istemci kimliği ve istemci gizli anahtarı) ihtiyacı vardır.
Sürüm belirleme
Google Sites Veri API'sına gönderdiğiniz her istekte 1.4 sürümü belirtilmelidir. Sürüm numarası belirtmek için GData-Version
HTTP üst bilgisini kullanın:
GData-Version: 1.4
Alternatif olarak, HTTP üst bilgilerini ayarlayamıyorsanız v=1.4
URL'sini URL'de bir sorgu parametresi olarak belirtebilirsiniz. Ancak mümkünse HTTP üstbilgisi tercih edilir.
Not: İstemci kitaplıkları uygun sürüm başlıklarını otomatik olarak sağlar. Bu nedenle, istemci kitaplığı kullanırken v=1.4
sorgu parametresini kullanmayın.
Site İçerik Takibi
Site feed'i, bir kullanıcının sahip olduğu veya görüntüleme iznine sahip olduğu Google Sites sitelerini listelemek ve mevcut bir sitenin başlığını değiştirmek için kullanılabilir. G Suite alanlarında, bir sitenin tamamını oluşturmak veya kopyalamak için de kullanılabilir.
Siteleri listeleme
Kullanıcının erişim sahibi olduğu siteleri listelemek için aşağıdaki URL'ye kimliği doğrulanmış GET
isteği gönderin:
https://sites.google.com/feeds/site/domainName
Feed parametresi | Açıklama |
---|---|
domainName | "site " veya G Suite'te barındırılan alanınızın (ör. example.com ) alanı. |
Yanıt, sitelerin listesini içeren bir feed içerir:
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/"CkUAQH4_eil7I2A9WxNaFk4.""> <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/"DkQGQHczfA9WxNaFk4.""> <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>
Siteler alfabetik sırada listelenir.
Yeni site oluşturma
Not: Bu özellik yalnızca G Suite alanlarında kullanılabilir.
Yeni sitelerin temel hazırlığı, site feed'ine bir HTTP POST
uygulanarak yapılabilir. Örneğin:
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>
Yukarıdaki istek, example.com
adlı G Suite alanı altında "seçenek listesi" temalı yeni bir Google Sitesi oluşturur.
Sitenin URL'si http://sites.google.com/a/example.com/source-site/ olur.
Site başarıyla oluşturulursa sunucu 201 Created
ile yanıt verir.
Yanıt girişi; site bağlantısı, sitenin EKL feed'ine bir bağlantı, site adı, başlık ve özet gibi sunucu tarafından eklenen öğeleri içerir.
<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/"DEECR38l7I2A9WxNaF0Q.""> <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>
Site kopyalama
Not: Bu özellik yalnızca G Suite alanlarında kullanılabilir.
Mevcut bir site, yeni site oluşturma ile aynı şekilde kopyalanabilir. Ancak POST
isteğinin Atom girişine, kopyalanacak sitenin site feed'ine işaret eden rel='source'
içeren bir <link>
ekleyin. Kopyalanmış tüm sitelerde
bu bağlantı bulunur. Aşağıda, bir sitenin kopyasını oluşturma örneği verilmiştir:
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>
Yukarıdaki istek, siteyi http://sites.google.com/a/example.com/source-site/ adresine kopyalar.
Önemli noktalar:
- Yalnızca kimliği doğrulanmış kullanıcıya ait siteler ve site şablonları kopyalanabilir.
- Site şablonları da kopyalanabilir. Site, Google Sites ayarlar sayfasında "Bu siteyi şablon olarak yayınla" ayarı işaretlenmişse bir şablondur.
- Kaynak sitede sahip olarak listelenmeniz koşuluyla bir siteyi başka bir alandan kopyalayabilirsiniz.
Bir sitenin meta verilerini güncelleme
Bir sitenin başlığını veya özetini güncellemek için site girişinin edit
bağlantısına HTTP PUT
gönderin.
Örneğin, aşağıdaki örnekte önceki sitenin başlığı New Test Site2
, açıklaması ise Newer description
olarak güncellenir.
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/"DEECR38l7I2A9WxNaF0Q.""> <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>
Kategori Ekleme
Not: Bu özellik yalnızca G Suite alanlarında kullanılabilir.
Alanınız için G Suite'teki siteler, alanınızdaki sitelerin sınıflandırılmasında yararlı olan kategori meta verileri içerir. Kategori meta verilerini eklemek veya güncellemek için site girişinizin edit
bağlantısına, category
etiketi içeren bir HTTP PUT
gönderin. Aşağıdaki örnekte kalın satıra bakın:
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/"DEECR38l7I2A9WxNaF0Q.""> <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>
Bu örnekte, mevcut bir site düzenlenmektedir ve "Ekip Sitesi" kategorisi eklenmiştir.
Başka <category>
etiketleriyle birden çok kategori de ekleyebilirsiniz. Aşağıdaki örnekte kalın olarak kullanılan satırlara bakın:
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/"DEECR38l7I2A9WxNaF0Q.""> <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>
Bu örnek iki kategori ekler: "Ekip Sitesi" ve "Hukuk Departmanı"
Web adresi eşlemeleri
Web adresi eşlemeleri, Sites kullanıcılarının kendi alanlarını bir Google Sites sitesi ile eşlemesine olanak tanır. Örneğin, http://sites.google.com/a/domain.com/mysite
yerine http://www.mydomainsite.com
kullanılabilir. Sitenizin barındırıldığı yere bağlı olarak, sitenin web adresi eşlemelerini manuel olarak değiştirebilirsiniz. Daha fazla bilgi edinmek için Yardım Merkezi makalemizi inceleyebilirsiniz.
Bir sitenin web adresi eşlemelerini getirme
Bir sitenin web adresi eşlemelerini döndürmek için site girişini/feed'ini with-mappings=true
parametresiyle getirin:
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/"DkQGQHczfA9WxNaFk4.""> <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>
Mevcut eşlemeler rel='webAddress Matching' ile link
olarak gösterilir. Örneğin, yukarıdaki örnekte http://sites.google.com/site/myOtherTestSite
sitesine işaret eden üç webAddressMapping
var.
Web adresi eşlemelerini değiştirme
Not: Tüm GET/POST/PUT işlemleri, web adresi eşlemeleriyle çalışırken with-mappings=true
parametresini belirtmelidir. Parametre yoksa webAddressMapping
'ler site girişlerinde (GET) döndürülmez veya bir girişteki eşlemeler güncellenirken/kaldırılırken (PUT) dikkate alınmaz.
Bir eşlemeyi eklemek, güncellemek veya silmek için yeni siteler oluştururken veya bir sitenin meta verilerini güncellerken bu tür bir bağlantıyı belirtmeniz, değiştirmeniz ya da kaldırmanız yeterlidir. with-mappings=true
parametresi, site feed'i URI'sine eklenmelidir.
Not: Adres eşlemelerini güncellemek için site yöneticisi, G Suite tarafından barındırılan sitelerde alan yöneticisi olmanız gerekir.
Örneğin, aşağıdaki istek http://www.my-new-sitemapping.com
ile http://www.mysitemapping.com
eşlemesini günceller ve bağlantıyı girişin dışında bırakarak http://www.mysitemapping2.com
öğesini kaldırır:
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/"DkQGQHczfA9WxNaFk4.""> <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>
Web adresi eşlemelerinin, site oluşturulurken/kopyalanırken da belirtilebileceğini unutmayın.
Etkinlik Feed'i
Bir Sitenin son etkinliklerini (değişiklikleri) etkinlik feed'ini getirerek getirebilirsiniz. Etkinlik feed'indeki her giriş, Site'de yapılan bir değişiklikle ilgili bilgileri içerir.
Etkinlik feed'ini sorgulamak için etkinlik feed'i URL'sine bir HTTP GET
gönderin:
https://sites.google.com/feeds/activity/domainName/siteName
Feed parametresi | Açıklama |
---|---|
domainName | "site " veya G Suite'te barındırılan alanınızın (ör. example.com ) alanı. |
siteName | Sitenizin web alanı adı; sitenin URL'sinde bulunur (ör. myCoolSite ). |
Örnek istek ve yanıt:
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/"CU4GQ3szfSl7ImA9WxNRFUg.""> <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/"CU8DQn45fyl7ImA9WxNRFUg.""> <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/"CU8AR3s4cSl7ImA9WxNRFUg.""> <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>
Not: Bu feed'e erişebilmek için Site'nin ortak çalışanı veya sahibi olmanız gerekir.
İstemciniz doğru Authorization
üst bilgisini göndermeli ve İstekleri yetkilendirme bölümünde alınan jetona referans vermelidir.
Düzeltme Özet Akışı
Herhangi bir içerik girişinin düzeltme geçmişini getirmek için girişin düzeltme bağlantısına HTTP GET
gönderin:
https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
Feed parametresi | Açıklama |
---|---|
domainName | "site " veya G Suite'te barındırılan alanınızın (ör. example.com ) alanı. |
siteName | Sitenizin web alanı adı; sitenin URL'sinde bulunur (ör. myCoolSite ). |
Belirli bir sayfanın/yorum/ek/liste öğesinin düzeltme bağlantısını bulmak için önce CONTENT_ENTRY_ID kimliğini kullanarak içerik feed'inden girişi alın. Alınan giriş, düzeltme yayınına ait bir <atom:link>
içerir.
Örneğin:
<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"/>
Örnek istek ve yanıt:
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/"CU4GQmA9WxNRFUg.""> <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&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/"CU8DQ388eSl7ImA9WxNRFUg.""> <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&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>
Not: Bu feed'e erişebilmek için Site'nin ortak çalışanı veya sahibi olmanız gerekir.
İstemciniz doğru Authorization
üst bilgisini göndermeli ve İstekleri yetkilendirme bölümünde alınan jetona referans vermelidir.
İçerik Feed'i
İçerik alınıyor
İçerik feed'i, bir Sites sitesinin mevcut içeriğini listeler. Aşağıdaki URL'ye kimliği doğrulanmış bir GET
isteği gönderin:
https://sites.google.com/feeds/content/domainName/siteName
Feed parametresi | Açıklama |
---|---|
domainName | "site " veya G Suite'te barındırılan alanınızın (ör. example.com ) alanı. |
siteName | Sitenizin web alanı adı; sitenin URL'sinde bulunur (ör. myCoolSite ). |
Sonuç olarak Sitedeki içerik girişlerinin ilk sayfasını listeleyen bir feed elde edilir. Feed'deki her bir giriş, webpage
, filecabinet
, attachment
, comment
gibi farklı bir içerik girişi türünü temsil eder. <category scheme="http://schemas.google.com/g/2005#kind">
öğesi, girişin türünü belirler. Destek kind
değerlerinin listesi için referans kılavuzuna bakın.
Not: Sitenin paylaşım izinlerine bağlı olarak bu feed, kimlik doğrulama gerektirebilir veya gerektirmeyebilir.
Site herkese açık değilse istemciniz doğru Authorization
üstbilgisini (yukarıdaki örnekte görüldüğü gibi) göndermeli ve İstekleri yetkilendirme bölümünde alınan jetonu referans göstermelidir.
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/"Ck8GQXk7fil7ImA9WxNSFk0.""> <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/"CkMBQH08fCl7ImA9WxNSFk0.""> <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/"AkYHQ3ozcCl7ImA9WxJaE08.""> <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>
Not: Bu, yalnızca ilk birkaç sonuçtur. İçerik feed'inin tamamı boyunca gezinmek için feed'in "sonraki" bağlantısını izleyin:
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>
Atom'un ortak öğelerinin açıklaması için Google Veri Protokolü referansını inceleyin.
Klasik Sites API'ye özel bir hedefe sahip olan öğeler aşağıda açıklanmıştır. Belirli tür girişlerin ek özellikleri (aşağıda listelenmemiştir) olsa da bazıları yoktur. Örneğin, bir listitem
girişinde <gs:field>
öğeleri varken bir webpage
girişinde bulunmayan öğeler olabilir.
Öğe | Açıklama |
---|---|
<content ...> | İç metin, sayfanın HTML gövdesidir. Bu öğe, bazı girişler (ör. ekler) için dosyaya işaret eden bir src özelliği içerir. |
<link rel="alternate" ...> | Google Sites'taki sayfa veya öğeye bağlantı oluşturun. |
<link rel="http://schemas.google.com/sites/2008#revision" ...> | href özelliği, girişin düzeltme feed'ini işaret ediyor. |
<link rel="http://schemas.google.com/sites/2008#parent" ...> | href özelliği, girişin üst girişine işaret ediyor. |
<link rel="http://schemas.google.com/sites/2008#template" ...> | href özelliği, girişin şablon sayfasına işaret eder. |
<category scheme="http://schemas.google.com/g/2005#kind" ...> | label giriş türüdür. |
<category term="http://schemas.google.com/g/2005#template" ...> | Girişin şablon olduğunu belirten label=template . |
<gd:feedLink> | href özelliği, girişin üst öğesinin alt öğelerini işaret ediyor. |
<sites:pageName> | Sayfanın URL'sindeki ada karşılık gelen sayfanın web alanı adı. |
<sites:revision> | Geçerli düzeltme numarası. |
İçerik feed'i sorgu örnekleri
Standart Google Data API sorgu parametrelerinden bazılarını ve klasik Sites API'ye özel parametreleri kullanarak içerik feed'inde arama yapabilirsiniz. Daha ayrıntılı bilgiler ve desteklenen parametrelerin tam listesi için Başvuru Kılavuzu'na göz atın.
Belirli giriş türlerini alma
Yalnızca belirli bir giriş türünü getirmek için kind
parametresini kullanın. Bu örnek yalnızca webpage
giriş döndürür:
GET /feeds/content/domainName/siteName?kind=webpage
Birden fazla giriş türü döndürmek için her kind
değerini bir "," ile ayırın. Bu örnek, filecabinet
ve
listpage
girişlerini döndürür:
GET /feeds/content/domainName/siteName?kind=filecabinet,listpage
Alternatif olarak, kind
parametresi yerine Google Veri /-/category
sorgusu için standart biçimi kullanabilirsiniz:
GET /feeds/content/domainName/siteName/-/filecabinet|listpage
Sayfa şablonlarını alma
Bu örnek yalnızca template
sayfa döndürür:
GET /feeds/content/domainName/siteName/-/template
Tüm giriş türlerini döndürmek ve template
sayfalarını dahil etmek için şunu kullanın:
GET /feeds/content/domainName/siteName/-/template|-template
Sayfa yola göre alınıyor
Google Sitesi'ndeki bir sayfanın göreli yolunu biliyorsanız söz konusu sayfayı getirmek için path
parametresini kullanabilirsiniz.
Bu örnek, http://sites.google.com/site/siteName/path/to/the/page
konumunda bulunan sayfayı döndürür:
GET /feeds/content/domainName/siteName?path=/path/to/the/page
Bir üst sayfanın altındaki tüm girişleri alma
Bir sayfanın giriş kimliğini biliyorsanız tüm alt girişlerini (varsa) getirmek için parent
parametresini kullanabilirsiniz:
GET /feeds/content/domainName/siteName?parent=CONTENT_ENTRY_ID
Taslaklar veya silinen girişler dahil
Taslak veya silinmiş girişleri dahil etmek için sırasıyla include-drafts
veya include-deleted
parametrelerini kullanın.
Bu örnek, içerik feed'indeki taslak girişleri içerir:
GET /feeds/content/domainName/siteName?include-drafts=true
Tam metin araması
Bir sitenin içeriğinin tamamında arama yapmak için tam metin araması yapmak üzere q
parametresini kullanın:
GET /feeds/content/domainName/siteName?q=Text%20I%20am%20looking%20for
İçerik Oluşturma
İçerik feed'ine bir HTTP POST
gönderilerek yeni içerik (web sayfaları, liste sayfaları, dosya dolabı sayfaları, duyuru sayfaları vb.) oluşturulabilir:
https://sites.google.com/feeds/content/domainName/siteName
Desteklenen giriş türlerinin listesi için Başvuru Kılavuzu'ndaki kind
parametresine bakın.
Yeni öğeler / sayfalar oluşturma
Bu örnek, Site'nin en üst düzeyinin altında yeni bir webpage
oluşturur, sayfa gövdesi için bazı XHTML'ler içerir ve başlık başlığını "Yeni Web Sayfası Başlığı" olarak ayarlar:
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>
İşlem başarılı olursa sunucu 201 Created
ve girişin bir kopyasıyla yanıt verir.
Özel URL yolları altında öğeler/sayfa oluşturma
Varsayılan olarak, önceki örnek http://sites.google.com/domainName/siteName/new-webpage-title
URL'sinin altında oluşturulur ve "Yeni Web Sayfası Başlığı" sayfa başlığına sahiptir. Yani <atom:title>
, URL için new-webpage-title
olarak normalleştirilir.
Bir sayfanın URL yolunu özelleştirmek için <sites:pageName>
öğesini ayarlayabilirsiniz.
Bu örnek, "Dosya Depolama" sayfa başlığına sahip yeni bir filecabinet
oluşturur ancak <sites:pageName>
öğesini belirterek sayfayı http://sites.google.com/domainName/siteName/files
URL'si altında oluşturur.
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>
Sunucu, bir sayfanın URL yolunu adlandırmak için aşağıdaki öncelik kurallarını kullanır:
<sites:pageName>
(varsa).a-z, A-Z, 0-9, -, _
şartını karşılamalıdır.<atom:title>
, pageName mevcut değilse boş olmamalıdır. Normalleştirmede, boşlukların kırpılıp "-" karakteri için daraltılması vea-z, A-Z, 0-9, -, _
ile eşleşmeyen karakterleri kaldırmanız gerekir.
Örneğin, "Özel_Sayfa2" sunucu tarafından kabul edilen bir sayfa olur.
Alt sayfalar oluşturma
Bir üst sayfa altında alt sayfalar (alt sayfalar) oluşturmak için yeni Atom girişinize bir <link rel="http://schemas.google.com/sites/2008#parent">
ekleyin. Bağlantının href
özelliğini üst girişin kendi bağlantısına ayarlayın.
Bu örnekte, giriş kimliği PARENT_ENTRY_ID
olan bir üst duyuru sayfasının altında "duyuru" başlıklı yeni bir announcement
oluşturulur. Sayfa gövdesine ilişkin XHTML içeriği de dahil edilir:
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>
Sayfa şablonları
Sayfa şablonları oluşturma
Sayfa şablonu oluşturma işlemi, yeni öğeler/sayfa oluşturma ve alt sayfalar oluşturma ile aynıdır.Aradaki fark, sırasıyla "http://schemas.google.com/g/2005#template" ve "template" olarak ayarlanmış category
ile birlikte eklenmesidir.
Bu örnek, yeni bir webpage
şablonu oluşturur.
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>
Şablondan sayfa oluşturma
Sayfa şablonları oluşturmaya benzer şekilde, bir sayfa şablonunun öz bağlantısına işaret eden rel='http://schemas.google.com/sites/2008#template' özelliğine sahip bir <link>
ekleyerek şablondan yeni bir sayfa örnekleyebilirsiniz.
Bu örnek, bir dosya dolabı tanımlayan mevcut bir sayfa şablonundan yeni bir filecabinet
sayfası oluşturur.
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>
Not: Girişinizde bir tane de dahil olmak üzere, <category>
tanımlayan bir şablon yine de gereklidir. Ayrıca, <content>
öğesi eklerseniz sunucunun bunu reddedeceğini de unutmayın.
Dosya yükleme
Bu API, Google Sites'ta olduğu gibi, dosya dolabı sayfalarına ve üst sayfalara ek yüklemenize olanak tanır.
Üst öğeye ek yüklemek için içerik feed'i URL'sine HTTP POST
isteği gönderin:
https://sites.google.com/feeds/content/domainName/siteName
POST
gövdesi, dosya içeriğinin ekin meta verilerini içeren bir <atom:entry>
ile birleştirmek için MIME çok parçalı isteği olmalıdır. <atom:entry>
, ekin nerede oluşturulacağını belirtmek için üst girişin öz bağlantısına başvurmalıdır.
Daha fazla bilgi için Alt sayfalar oluşturma konusuna bakın.
Ekler yükleniyor
PARENT_ENTRY_ID
kimliğine sahip bir dosya dolabına PDF dosyası yükleme örneği aşağıda verilmiştir. Ek, "PDF Dosyası" başlığı ve (isteğe bağlı) bir açıklama olan "HR paketi" ile oluşturulur.
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--
Yükleme başarılı olursa sunucu, 201 Created
ve yeni oluşturulan ek girişinin bir kopyasıyla yanıt verir.
Klasöre ek yükleme
filecabinet
klasöründeki mevcut bir klasöre ek yüklemek için "term" özelliği klasörün adına ayarlanmış bir kategori ekleyin:
<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">
Web ekleri
Web ekleri, özel ek türleridir. Esas olarak, dosya dolabı girişlerinize ekleyebileceğiniz web'deki diğer dosyaların bağlantılarıdır. Bu özellik, Google Sites kullanıcı arayüzündeki "URL ile dosya ekle" yükleme yöntemine benzer.
Not: Web ekleri yalnızca bir dosya dolabı sayfasında oluşturulabilir. Diğer sayfa türlerine yüklenemezler.
Bu örnek, FILECABINET_ENTRY_ID
kimliğinin başvurduğu dosya dolabı altında bir webattachment
oluşturur.
Başlığı ve (isteğe bağlı) açıklaması sırasıyla 'GoogleLogo' ve 'güzel renkler' olarak ayarlanır.
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
, kullanıcının dosya dolabında "http://www.google.com/images/logo.gif" adresindeki resme işaret eden bir bağlantı oluşturur.
İçerik Güncelleniyor
Herhangi bir sayfanın meta verileri (başlık, pageName vb.) ve sayfa içeriği, edit
bağlantısına yapılan tek bir PUT
isteğiyle düzenlenebilir.
İsteğin gövdesi, güncellenen sayfayı açıklayan bir Atom girişi içermelidir. Bu kuralın istisnası, yalnızca ekin meta verilerini güncellemek için kullanılabilen ek girişleridir.
Ekli dosyanın içeriğini değiştirmek için ekin edit-media
bağlantısına bir PUT
isteğinin gövdesi olarak ham verileri eklemeniz yeterlidir. Ayrıca, çok parçalı bir MIME isteği kullanarak hem meta verileri hem de ekli dosya içeriğini aynı anda güncelleyebilirsiniz.
Güncellemenizin başka bir istemcide yapılan değişikliklerin üzerine yazılmadığını onaylamak için orijinal girişin ETag değerini ekleyin. Bunu bir HTTP If-Match
üst bilgisinde ETag değerini sağlayarak veya güncellenmiş girişe orijinal girişin gd:etag
özelliğini ekleyerek yapabilirsiniz. Orijinal girişin ETag değerini belirlemek için <entry>
öğesinin gd:etag
özelliğini inceleyin.
Medya girişleri için medyanın ETag, edit-media
bağlantısının gd:etag
özelliğinde kullanılabilir.
Girişi, aldıktan sonra başka birinin güncelleyip güncellemediğine bakılmaksızın güncellemek istiyorsanız If-Match: *
kullanın ve ETag'i eklemeyin. ETag'ler hakkında daha fazla bilgi için Google Veri API'leri başvuru kılavuzuna bakın.
Bir öğenin meta verilerini veya HTML içeriğini güncelleme
Bir girişin meta verilerini veya HTML içeriğini güncellemek için girişin edit
bağlantısına HTTP PUT
gönderin.
Aşağıda, bir listpage
girişini (ENTRY_ID
kimliğiyle temsil edilir) aşağıdaki değişikliklerle güncelleme örneği verilmiştir:
- Başlık "Güncellenen İçerik" olarak değiştirilir
- Güncellenen HTML içeriği
- Listenin ilk sütun başlığı "Sahip" olarak güncellenir
- Sayfanın URL yolu,
<sites:pageName>
öğesi tarafından değiştirildi
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/"CEEBRn0ymA9WxJWEUw.""> <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>
Not: Giriş (sunucu tarafından döndürülen) yukarıdaki örnekten daha fazla öğe içerir.
Ekin içeriğini değiştirme
Aşağıda, ekin meta verilerini değiştirmeden bırakmaya ilişkin bir örnek verilmiştir. İstek yeni içerik içerdiğinden, ek girişinin edit-media
bağlantısı kullanılır.
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 ...
Ek meta verilerini ve içeriği güncelleme
Aşağıda, bir ekin hem meta verilerini hem de içeriğini aynı anda güncellemeyle ilgili bir örnek verilmiştir. Ekin adı "Yeni Başlık" olarak güncellenecek ve içeriği bir .zip dosyasının içeriğiyle değiştirilecek. İstek yeni dosya içeriği içerdiğinden ek girişinin edit-media
bağlantısı kullanılır.
Medya içeriğinde yapılan herhangi bir güncelleme, meta verilerin ETag'inin değişmesine neden olur. Bu nedenle, meta veriler için ETag'i eklemenin medya içeriği için de dolaylı bir If-Match
sağladığını unutmayın.
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
İçerik Siliniyor
Bir öğeyi Google Sites sitesinden kaldırmak için öncelikle girişi alın, ardından girişin edit
URL'sine bir DELETE
isteği gönderin. Bu, bir öğenin meta verisini veya html içeriğini güncellerken kullanılan URL'dir.
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>
Giriş başarıyla silindiyse sunucu bir HTTP 200 OK
ile yanıt verir.
Başka bir istemci tarafından değiştirilen bir girişi, siz aldıktan sonra silmediğinizden emin olmak istiyorsanız orijinal girişin ETag değerini içeren bir HTTP If-Match
üst bilgisi ekleyin. <entry>
öğesinin gd:etag
özelliğini inceleyerek orijinal girişin ETag değerini belirleyebilirsiniz.
Girişi, aldıktan sonra başka birinin güncelleyip güncellemediğine bakılmaksızın silmek isterseniz If-Match: *
kullanın ve ETag eklemeyin. (Bu durumda, girişi silmeden önce geri almanız gerekmez.)
ETag'ler hakkında daha fazla bilgi için Google Veri API'leri başvuru kılavuzuna bakın.
Ekleri İndirme
Bir ek girişi oluşturduktan sonra, girişin <content>
src bağlantısına kimliği doğrulanmış HTTP GET
göndererek dosyayı indirebilirsiniz. Örnek PDF içerik bağlantısı:
<content type="application/pdf" src="http://502377765-a-google-com-s-sites.googlegroups.com/feeds/media/content/domainName/siteName/678942036"/>
EKL Feed'i
İzin Paylaşımına (EKL'ler) Genel Bakış
EKL feed'indeki her EKL girişi; bir kullanıcı, kullanıcı grubu, alan ya da varsayılan erişim (herkese açık bir site) olmak üzere belirli bir varlığın erişim rolünü temsil eder. Girişler, yalnızca açık erişimi olan varlıklar için gösterilir. Google Sites kullanıcı arayüzünün paylaşım ekranındaki "Erişimi Olan Kişiler" panelinde her e-posta adresi için bir giriş gösterilir. Bu nedenle, bir siteye dolaylı erişimi olsa bile alan yöneticileri gösterilmez.
Roller
Rol öğesi, bir varlığın sahip olabileceği erişim düzeyini temsil eder. gAcl:role
öğesinin dört olası değeri vardır:
- reader: Görüntüleyen (salt okuma erişimidir).
- writer — Ortak çalışan (okuma/yazma erişimine eşdeğerdir).
- sahip - genellikle site yöneticisidir (okuma/yazma erişimine eşdeğerdir).
Kapsamlar
Kapsam öğesi, bu erişim düzeyine sahip varlığı temsil eder. Beş olası gAcl:scope
öğesi türü vardır:
- kullanıcı: Bir e-posta adresi değeridir (ör. "kullanici@gmail.com").
- group: Bir Google Grubu e-posta adresi (ör. "grup@alanadi.com").
- alan — bir G Suite alan adıdır, ör. "alanadi.com".
- invite: Siteye davet edilmiş ancak sitenin EKL'sine henüz eklenmemiş kullanıcı. (gdata 1.3 veya altı belirtilirse kullanılamaz.)
- default: "default" türünde yalnızca bir olası kapsam vardır (ör.
<gAcl:scope type="default">
). Bu kapsam, herhangi bir kullanıcının herkese açık bir sitede varsayılan olarak sahip olduğu erişimi kontrol eder.
Not: Alanların gAcl:role
değeri "sahip" olarak ayarlanamaz. Yalnızca okuyucu veya yazar olabilirler.
"Davet" kapsamı hakkında.
EKL'ye, önceden Google hesabı olmayan bir veya daha fazla kullanıcı eklediğinizde API, davet kapsamını döndürür. API, davet ettiğiniz kullanıcıların daveti kabul edebilmesi için bu kullanıcılara sağlamanız gereken yerleşik jeton içeren bir URL döndürür.
Bu davet yöntemi, kullanmak istedikleri e-posta adresini bilmeden Google dışı kullanıcıları davet etmenize olanak tanır. Kullanıcılar yerleştirilmiş jetonun bulunduğu davetiye URL'sini tıkladığı sürece istedikleri e-posta adresini kullanarak erişim için kaydolabilirler. Ayrıca, birden çok kullanıcı davetiyeyi kabul etmek için potansiyel olarak bu URL'yi kullanabilir. Dolayısıyla bu, bir kullanıcıyı veya bir kullanıcı grubunu davet ederken yararlı olabilir.
Not: "Davet" kapsamı yalnızca gdata sürüm 1.4 ve üzeri sürümlerde kullanılabilir. 1.3 veya daha önceki sürümleri açıkça belirtiyorsanız bu özellik çalışmaz.
EKL feed'i alınıyor
EKL feed'i, bir sitenin paylaşım izinlerini kontrol etmek için kullanılabilir ve şu URI üzerinden erişilebilir:
https://sites.google.com/feeds/acl/site/domainName/siteName
Feed parametresi | Açıklama |
---|---|
domainName | "site " veya G Suite'te barındırılan alanınızın (ör. example.com ) alanı. |
siteName | Sitenizin web alanı adı; sitenin URL'sinde bulunur (ör. myCoolSite ). |
Site özet akışındaki her girişin şu özet akışına bir bağlantı içerdiğini unutmamak gerekir:
<link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
Bir sitenin paylaşım izinlerini almak için HTTP GET
öğesini EKL feed URI'sine gönderin:
GET /feeds/acl/site/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here>
Sunucu bir 200 OK
ve EKL girişlerinin feed'iyle yanıt verir:
<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>
Site paylaşma
EKL feed'i GET
, POST
ve PUT
isteklerini kabul eder. EKL feed'ine yeni bir rol eklemek için sitenin EKL feed'ine bir POST
isteği göndermeniz yeterlidir.
Not: Belirli EKL'lerin paylaşılması, yalnızca alan bu tür izinlere izin verecek şekilde yapılandırılmışsa (ör.G Suite alanları için alan dışında paylaşım etkinse vb.) mümkün olabilir.
Bu örnekte, siteye yeni bir ortak çalışan (yazar) eklenir:
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>
Başarılı bir ekleme yapıldığında bir 201 Created
ve yeni giriş döndürülür:
<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>
Kullanıcıları "davet" kapsamıyla davet etme
Google hesabı olmayan kullanıcıları eklerseniz API, davet etmek istediğiniz kullanıcılara sağlamanız gereken bir URL döndürür. URL'yi tıkladıktan sonra, mevcut bir hesapla oturum açarak veya yeni bir hesap oluşturarak siteye erişim elde edebilirler.
Başarılı bir davetiye, bir 201 Created
ve kullanıcıya iletmeniz gereken URL'yi içeren yeni bir giriş döndürür:
<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>
Grup ve Alan düzeyinde paylaşım
Bir siteyi tek bir kullanıcıyla paylaşmaya benzer şekilde, bir siteyi bir Google grubu veya G Suite alanında paylaşabilirsiniz. Gerekli scope
değerleri aşağıda listelenmiştir.
Grup e-posta adresiyle paylaşma:
<gAcl:scope type="group" value="group@example.com"/>
Alanın tamamıyla paylaşma:
<gAcl:scope type="domain" value="example.com"/>
Alan düzeyinde paylaşım, yalnızca G Suite alanları için ve yalnızca sitenin barındırıldığı alan için desteklenir. Örneğin, http://sites.google.com/a/alan1.com/siteA, Sitenin tamamını alan1.com ile paylaşabilir, alan2.com ile paylaşamaz. G Suite alanında barındırılmayan siteler (ör. http://sites.google.com/site/siteB) alan davet edemez.
Paylaşım izinlerini değiştirme
Bir ACL girişini güncellemek için girişi gerektiği şekilde değiştirin ve girişin edit
bağlantısına bir HTTP PUT
isteği gönderin. Girişin "rel" özelliği "edit" olarak ayarlanmış <link>
öğesidir. Önceki örnekte bu bağlantı şu şekildedir:
<link rel='edit' type='application/atom+xml' href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>
Aşağıdaki snippet, new_writer@gmail.com
adlı kullanıcının rolünü "okuyucu" olarak değiştirir:
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>
Paylaşım izinleri kaldırılıyor
Bu kullanıcının izinlerini kaldırmak için PUT
isteği için kullanılan edit
bağlantısına bir DELETE
isteği gönderin:
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>
Sunucu 200 OK
ile yanıt verir.
Özel Konular
Bir feed'i veya girişi tekrar alma
Daha önce aldığınız bir feed'i veya girişi almak istiyorsanız sunucuya yalnızca listeyi veya girişi, yalnızca son aldığınız zamandan bu yana değiştiyse göndermesini söyleyerek verimliliği artırabilirsiniz.
Bu tür bir koşullu alma işlemi yapmak için HTTP If-None-Match
başlığı içeren bir HTTP GET
isteği gönderin. Başlıkta, listenin veya girişin ETag'ini belirtin. ETag'i <feed>
öğesinin veya <entry>
öğesinin gd:etag
özelliğinde bulabilirsiniz.
Site feed'inin kullanıldığı bir örnek:
GET /feeds/site/domainName/myOtherTestSite/ GData-Version: 1.4 If-None-Match: W/"Ck8GQXk7fil7ImA9WxNSFk0."
Sunucu bu isteği aldığında, istediğiniz öğenin belirttiğiniz ETag ile aynı ETag'e sahip olup olmadığını kontrol eder. ETag'ler eşleşirse öğe değişmemiştir ve sunucu bir HTTP 304 Not Modified
durum kodu veya HTTP 412 Precodition Failed
durum kodu döndürür. Bu durum kodlarının her ikisi de, önceden aldığınız öğenin güncel olduğunu belirtir.
ETag'ler eşleşmezse öğe, son isteğinizden sonra değiştirilmiş ve sunucu öğeyi döndürmüş demektir.
ETag'ler hakkında daha fazla bilgi için Google Veri API'leri başvuru kılavuzuna bakın.
Toplu İşleme
Toplu istekler, istemcinize her işlemi ayrı ayrı göndermek yerine birden fazla işlemi tek bir istekte yürütme imkanı sunar.
Sunucu mümkün olduğunca çok istenilen değişikliği gerçekleştirir ve her işlemin başarılı veya başarısız olduğunu değerlendirmek için kullanabileceğiniz durum bilgilerini döndürür. Google Data API'de toplu işlem hakkında daha fazla bilgi için Google Veri API'leri ile Toplu İşleme bölümüne bakın
Toplu feed'deki her işlem, ekleme işlemleri hariç bir <id> öğesine sahiptir.
Bu öğe, içerik feed'ini güncellerken, silerken veya sorgularken normalde kullanacağınız istek URL'siyle aynıdır.
Örneğin, bir düzenlemeyi güncelliyorsanız <id> öğesini söz konusu girişin edit
bağlantısı olarak ayarlayın.
Hedef girişi tanımlamak için kullanılır. Yeni girişler, henüz oluşturulmadıkları için <id> öğesi içermez. Bunun yerine, <batch:id> içinde bir dize değeri tanımlayabilirsiniz. Bu değer, sunucunun yanıtında döndürülür ve ilgili girişi aramak için kullanılır.
Toplu istek yapmak için toplu feed oluşturun ve feed'in toplu bağlantısına bir HTTP POST
gönderin:
<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="https://sites.google.com/feeds/content/site/siteName/batch"/>
Aşağıdaki örnekte bir web sayfası girişinin nasıl sorgulanacağı, ekleneceği, güncelleneceği ve silineceği gösterilmektedir:
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=""YDgpeyI.""> <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=""YassseyI.""> <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id> <batch:operation type='delete'/> </entry> </feed>
Döndürülen feed, her işlem için bir sonuç girişi içerir:
<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=""YDgpsdfeyI."">
<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=""YDsseyI."">
<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=""YDkpeyI."">
<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>