以前の Google Sites API を使用すると、アプリケーションから Google サイト内のコンテンツにアクセスし、コンテンツを公開、変更できます。 さらに、最近のアクティビティのリストのリクエスト、変更履歴の取得、添付ファイルやファイルのアップロードとダウンロードを行うことも可能です。
対象
このドキュメントは、Google Data API プロトコルの背後にある一般的な概念を理解していることを前提としています。
このドキュメントは、Google サイトとやり取りできるクライアント アプリケーションを作成するプログラマーを対象としています。XML/HTTP を使用する Data API の基本的なインタラクションの例と説明を示します。このドキュメントを読んだ後、クライアント ライブラリを使用した API 操作の詳細について、左側のナビゲーション バーにある他のガイドにある言語別の例をご覧ください。
このガイドの内容については、リファレンス ガイドをご覧ください。
リクエストの承認
アプリケーションが非公開のユーザーデータをリクエストする場合は、認証トークンを含める必要があります。このトークンは Google でアプリケーションを識別するためにも使用されます。
認証プロトコルについて
リクエストを承認するために、アプリケーションは OAuth 2.0 を使用する必要があります。これ以外の認証プロトコルには対応していません。アプリケーションで「Google でログイン」を使用している場合、承認手続きの一部が自動化されます。
OAuth 2.0 を使用したリクエストの承認
非公開のユーザーデータに対する Google Sites Data API へのリクエストは、認証されたユーザーによって承認される必要があります。
OAuth 2.0 の承認プロセス(「フロー」)の詳細は開発するアプリケーションの種類によって若干異なりますが、次の一般的なプロセスはすべての種類のアプリケーションに当てはまります。
- アプリケーションの作成時に、Google API Console を使用してアプリケーションを登録します。登録すると、後で必要になるクライアント ID やクライアント シークレットなどの情報が Google から提供されます。
- Google API Console で Google Sites Data API を有効にします(Indexing API が API Console に表示されない場合は、この手順をスキップしてください)。
- アプリケーションでユーザーデータにアクセスする必要がある場合は、特定のアクセスのスコープを Google にリクエストします。
- データをリクエストするアプリケーションの承認を求める Google の同意画面がユーザーに表示されます。
- ユーザーが承認すると、有効期間の短いアクセス トークンがアプリケーションに付与されます。
- アプリケーションは、リクエストにそのアクセス トークンを付与してユーザーデータをリクエストします。
- Google がそのリクエストとトークンが有効であると判断すると、リクエストされたデータが返されます。
プロセスによっては、更新トークンを使用して新しいアクセス トークンを取得するなど、追加の手順が必要になる場合もあります。各種アプリケーションのフローについて詳しくは、Google の OAuth 2.0 ドキュメントをご覧ください。
Google Sites Data API で使用される OAuth 2.0 のスコープ情報は次のとおりです。
https://sites.google.com/feeds/
OAuth 2.0 を使用してアクセスをリクエストする場合、アプリケーションを登録したときに Google から提供された情報(クライアント ID やクライアント シークレットなど)に加えて、スコープ情報が必要になります。
バージョンの指定
Google Site Data API へのリクエストには必ずバージョン 1.4 を指定してください。バージョン番号を指定するには、GData-Version
HTTP ヘッダーを使用します。
GData-Version: 1.4
HTTP ヘッダーを設定できない場合は、URL のクエリ パラメータとして v=1.4
を指定できます。ただし、可能であれば HTTP ヘッダーをおすすめします。
注: クライアント ライブラリは適切なバージョン ヘッダーを自動的に提供するため、クライアント ライブラリを使用している場合は v=1.4
クエリ パラメータを使用しないでください。
サイトフィード
サイトフィードを使用すると、ユーザーが所有する Google サイトや閲覧権限のある Google サイトを一覧表示したり、既存のサイトのタイトルを変更したりできます。G Suite ドメインの場合は、サイト全体を作成またはコピーするためにも使用できます。
サイトの一覧表示
ユーザーがアクセスできるサイトを一覧表示するには、認証済みの GET
リクエストを次の URL に送信します。
https://sites.google.com/feeds/site/domainName
フィード パラメータ | 説明 |
---|---|
domainName | 「site 」、または G Suite でホストされているドメイン(例: example.com )です。 |
レスポンスには、サイトのリストを含むフィードが含まれます。
GET /feeds/site/domainName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/site/site</id> <updated>2009-12-02T17:47:34.406Z</updated> <title>Site</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/site/site"/> <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://sites.google.com/feeds/feeds/site/domainName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName"/> <link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/?start-index=2"/> <generator version="1" uri="http://sites.google.com/">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry gd:etag="W/"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>
サイトはアルファベット順に表示されます。
新しいサイトを作成する
注: この機能は G Suite ドメインでのみご利用いただけます。
新しいサイトは、サイトフィードに HTTP POST
を送信することでプロビジョニングできます。次に例を示します。
POST /feeds/site/example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <title>Source Site</title> <summary>A new site to hold memories</summary> <sites:theme>slate</sites:theme> </entry>
上記のリクエストでは、G Suite ドメイン example.com
に「スレート」テーマの新しい Google サイトが作成されます。
この場合、サイトの URL は http://sites.google.com/a/example.com/source-site/ となります。
サイトが正常に作成されると、サーバーは 201 Created
を返します。レスポンス エントリには、サイトへのリンク、サイトの ACL フィードへのリンク、サイト名、タイトル、サマリーなど、サーバーによって追加された要素が含まれます。
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/"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>
サイトをコピーする
注: この機能は G Suite ドメインでのみご利用いただけます。
既存のサイトを複製する方法は、新しいサイトを作成する方法と同じです。ただし、POST
リクエストの Atom エントリには、コピーするサイトのサイトフィードを指す rel='source'
を持つ <link>
を含めます。コピーされたすべてのサイトにこのリンクが表示されます。サイトの複製の例を次に示します。
POST /feeds/site/example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom"> <link rel="http://schemas.google.com/sites/2008#source" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/> <title>Copy of New Test Site</title> <summary>A newer site to hold memories</summary> </entry>
上記のリクエストでは、http://sites.google.com/a/example.com/source-site/ がコピーされます。
注意事項:
- コピーできるのは、認証済みのユーザーが所有するサイトとサイト テンプレートのみです。
- サイト テンプレートをコピーすることもできます。Google サイトの設定ページで [このサイトをテンプレートとして公開する] 設定がオンになっている場合、サイトはテンプレートです。
- ソースサイトで所有者として登録されている間は、別のドメインからサイトをコピーできます。
サイトのメタデータの更新
サイトのタイトルまたは概要を更新するには、HTTP PUT
をサイトエントリの edit
リンクに送信します。たとえば次の例では、前のサイトのタイトルを New Test Site2
に、説明を Newer description
に更新します。
PUT /feeds/site/example.com/source-site HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/"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>
カテゴリを追加する
注: この機能は G Suite ドメインでのみご利用いただけます。
G Suite for your Domain のサイトには、ドメイン内のサイトの分類に役立つカテゴリ メタデータが含まれています。カテゴリのメタデータを追加または更新するには、category
タグを含むサイトエントリの edit
リンクに HTTP PUT
を送信します。次の例の太字の行をご覧ください。
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>
この例では、既存のサイトを編集して、カテゴリ「Team Site」を追加しています。
<category>
タグを追加して、複数のカテゴリを追加することもできます。次の例の太字の行をご覧ください。
PUT /feeds/site/example.com/my-team-site HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/"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>
この例では、「Team Site」と「Legal Department」の 2 つのカテゴリを追加しています。
ウェブアドレスのマッピング
ウェブアドレスのマッピングを使用すると、Google サイトのユーザーは自分のドメインを Google サイトにマッピングできます。たとえば、http://sites.google.com/a/domain.com/mysite
の代わりに http://www.mydomainsite.com
を使用できます。サイトがホストされている場所に応じて、サイトのウェブアドレスのマッピングを手動で変更できます。詳しくは、ヘルプセンターの記事をご覧ください。
サイトのウェブアドレスのマッピングの取得
サイトのウェブアドレスのマッピングを返すには、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/"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>
既存のマッピングは、rel='webAddressMapping' が指定された link
として表示されます。たとえば、上記の例では、サイト http://sites.google.com/site/myOtherTestSite
を指す 3 つの webAddressMapping
があります。
ウェブアドレスのマッピングの変更
注: すべての GET/POST/PUT オペレーションで、ウェブアドレス マッピングを操作するときは with-mappings=true
パラメータを指定する必要があります。パラメータが存在しない場合、webAddressMapping
はサイトエントリで返されません(GET)。また、エントリからのマッピングの更新または削除(PUT)の際にも考慮されません。
マッピングを追加、更新、削除するには、新しいサイトの作成時またはサイトのメタデータの更新時に、そのようなリンクを指定、変更、削除します。サイトフィードの URI に with-mappings=true
パラメータを含める必要があります。
注: アドレスのマッピングを更新するには、サイト管理者か、ドメイン管理者(G Suite でホストされているサイトの場合)の権限が必要です。
たとえば、次のリクエストでは、http://www.mysitemapping.com
マッピングを http://www.my-new-sitemapping.com
に更新し、リンクをエントリから外すことで http://www.mysitemapping2.com
を削除します。
PUT /feeds/site/domainName?with-mappings=true HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry gd:etag="W/"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>
ウェブアドレスのマッピングは、サイトの作成時またはコピー時にも指定できます。
アクティビティ フィード
サイトの最近のアクティビティ(変更)を取得するには、アクティビティ フィードを取得します。アクティビティ フィードの各エントリには、サイトに加えられた変更に関する情報が含まれています。
アクティビティ フィードをクエリするには、HTTP GET
をアクティビティ フィードの URL に送信します。
https://sites.google.com/feeds/activity/domainName/siteName
フィード パラメータ | 説明 |
---|---|
domainName | 「site 」、または G Suite でホストされているドメイン(例: example.com )です。 |
siteName | サイトのウェブスペース名。サイトの URL に含まれています(例: myCoolSite )。 |
リクエストとレスポンスの例:
GET /feeds/activity/site/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"> <id>https://sites.google.com/feeds/activity/site/siteName</id> <updated>2009-09-10T05:24:23.120Z</updated> <title>Activity</title> <link rel="alternate" type="text/html" href="http://sites.google.com/site/siteName/system/app/pages/recentChanges"/> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"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>
注: このフィードにアクセスするには、サイトの共同編集者またはオーナーである必要があります。
クライアントは正しい Authorization
ヘッダーを送信し、リクエストの承認で取得したトークンを参照する必要があります。
リビジョン フィード
コンテンツ エントリの変更履歴を取得するには、HTTP GET
をエントリのリビジョン リンクに送信します。
https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
フィード パラメータ | 説明 |
---|---|
domainName | 「site 」、または G Suite でホストされているドメイン(例: example.com )です。 |
siteName | サイトのウェブスペース名。サイトの URL に含まれています(例: myCoolSite )。 |
特定のページ/コメント/添付/リストアイテムのリビジョン リンクを検索するには、まず、CONTENT_ENTRY_ID を使用してコンテンツ フィードからエントリを取得します。取得したエントリには、リビジョン フィードへの <atom:link>
が含まれます。例:
<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>
リクエストとレスポンスの例:
GET /feeds/revision/domainName/siteName/CONTENT_ENTRY_ID HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID</id> <updated>2009-09-10T04:33:35.337Z</updated> <title>Revisions</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry gd:etag="W/"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>
注: このフィードにアクセスするには、サイトの共同編集者またはオーナーである必要があります。
クライアントは正しい Authorization
ヘッダーを送信し、リクエストの承認で取得したトークンを参照する必要があります。
コンテンツ フィード
コンテンツの取得
コンテンツ フィードには、Google サイトの現在のコンテンツの一覧が表示されます。認証済みの GET
リクエストを次の URL に送信します。
https://sites.google.com/feeds/content/domainName/siteName
フィード パラメータ | 説明 |
---|---|
domainName | 「site 」、または G Suite でホストされているドメイン(例: example.com )です。 |
siteName | サイトのウェブスペース名。サイトの URL に含まれています(例: myCoolSite )。 |
その結果、サイト上のコンテンツ エントリの最初のページを一覧表示するフィードが作成されます。フィード内の各エントリは、webpage
、filecabinet
、attachment
、comment
など、異なるタイプのコンテンツ エントリを表します。<category scheme="http://schemas.google.com/g/2005#kind">
要素により、エントリのタイプが決まります。サポートされている kind
値の一覧については、リファレンス ガイドをご覧ください。
注: このフィードは、サイトの共有権限に応じて、認証が不要な場合もあります。
サイトが非公開の場合、クライアントは正しい Authorization
ヘッダーを送信し(上記の例を参照)、リクエストの承認で取得したトークンを参照する必要があります。
GET /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/content/domainName/siteName</id> <updated>2009-08-31T01:39:20.286Z</updated> <title>Content</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName"/> <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName"/> <link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/batch""/> <link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry gd:etag="W/"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>
注: これは最初の数件の結果にすぎません。コンテンツ フィード全体をページ目で確認するには、フィードの [次へ] リンクを使用します。
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>
Atom の共通要素については、Google Data Protocol のリファレンスをご覧ください。
以前の Google サイト API で重要な役割を果たす要素については、以下で説明します。追加のプロパティ(下記に示されていない)を持つエントリと、持たないエントリがあります。たとえば、listitem
エントリには <gs:field>
要素が含まれ、webpage
エントリには含まれないことがあります。
要素 | 説明 |
---|---|
<content ...> | 内部テキストはページの HTML 本文です。一部のエントリ(添付ファイルなど)では、この要素にはファイルを指す src 属性が含まれます。 |
<link rel="alternate" ...> | Google サイトのページまたはアイテムにリンクします。 |
<link rel="http://schemas.google.com/sites/2008#revision" ...> | href 属性は、エントリのリビジョン フィードを指します。 |
<link rel="http://schemas.google.com/sites/2008#parent" ...> | href 属性は、エントリの親エントリを指します。 |
<link rel="http://schemas.google.com/sites/2008#template" ...> | href 属性は、エントリのテンプレート ページを指します。 |
<category scheme="http://schemas.google.com/g/2005#kind" ...> | label はエントリのタイプです。 |
<category term="http://schemas.google.com/g/2005#template" ...> | label=template は、エントリがテンプレートであることを示します。 |
<gd:feedLink> | href 属性は、エントリの親の子を指します。 |
<sites:pageName> | ページのウェブスペース名。ページの URL 内の名前に対応しています。 |
<sites:revision> | 現在のリビジョン番号。 |
コンテンツ フィードクエリの例
標準の Google Data API クエリ パラメータと、以前の Google サイト API に固有のパラメータを使用して、コンテンツ フィードを検索できます。サポートされているパラメータの詳細と一覧については、リファレンス ガイドをご覧ください。
特定のエントリの種類を取得する
特定のタイプのエントリのみを取得するには、kind
パラメータを使用します。この例では、webpage
エントリのみを返します。
GET /feeds/content/domainName/siteName?kind=webpage
複数のエントリタイプを返すには、各 kind
を「,」で区切ります。この例では、filecabinet
エントリと listpage
エントリを返します。
GET /feeds/content/domainName/siteName?kind=filecabinet,listpage
または、kind
パラメータの代わりに、Google データの /-/category
クエリの標準形式を使用することもできます。
GET /feeds/content/domainName/siteName/-/filecabinet|listpage
ページ テンプレートの取得
この例では、template
ページのみが返されます。
GET /feeds/content/domainName/siteName/-/template
すべてのエントリタイプを返し、template
ページを含めるには、次のコマンドを使用します。
GET /feeds/content/domainName/siteName/-/template|-template
パスによるページの取得
Google サイト内のページの相対パスがわかっている場合は、path
パラメータを使用してその特定のページを取得できます。
この例では、http://sites.google.com/site/siteName/path/to/the/page
にあるページが返されます。
GET /feeds/content/domainName/siteName?path=/path/to/the/page
親ページ内のすべてのエントリを取得する
ページのエントリ ID がわかっている場合は、parent
パラメータを使用してその子エントリ(ある場合)をすべて取得できます。
GET /feeds/content/domainName/siteName?parent=CONTENT_ENTRY_ID
下書きや削除済みのエントリを含める
下書きのエントリや削除済みのエントリを含めるには、それぞれ include-drafts
パラメータまたは include-deleted
パラメータを使用します。この例には、コンテンツ フィードの下書きのエントリが含まれています。
GET /feeds/content/domainName/siteName?include-drafts=true
全文検索
サイトのコンテンツ全体を検索するには、q
パラメータを使用して全文検索を実行します。
GET /feeds/content/domainName/siteName?q=Text%20I%20am%20looking%20for
コンテンツの作成
新しいコンテンツ(ウェブページ、リストページ、ファイルキャビネット ページ、お知らせページなど)を作成するには、HTTP POST
をコンテンツ フィードに送信します。
https://sites.google.com/feeds/content/domainName/siteName
サポートされているエントリタイプの一覧については、リファレンス ガイドの kind
パラメータをご覧ください。
新しいアイテムやページの作成
次の例では、サイトのトップレベルに新しい webpage
を作成し、ページ本文に XHTML をいくつか組み込んで、見出しのタイトルを「New WebPage Title」に設定しています。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 328 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>New Webpage Title</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div> </content> </entry>
成功すると、サーバーは 201 Created
とエントリのコピーを返します。
カスタム URL パスでのアイテム/ページの作成
デフォルトでは、上記の例は URL http://sites.google.com/domainName/siteName/new-webpage-title
の下に作成され、ページ見出しは「新しいウェブページのタイトル」に設定されます。つまり、<atom:title>
は URL に対して new-webpage-title
に正規化されます。ページの URL パスをカスタマイズするには、<sites:pageName>
要素を設定します。
この例では、ページ見出しが「File Storage」の新しい filecabinet
を作成しますが、<sites:pageName>
要素を指定することで、URL http://sites.google.com/domainName/siteName/files
の下にページを作成します。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 393 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/> <title>File Storage</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">A list of files is below.</div> </content> <sites:pageName>files</sites:pageName> </entry>
サーバーは、ページの URL パスに次の優先順位ルールを適用します。
<sites:pageName>
(存在する場合)。a-z, A-Z, 0-9, -, _
を満たす必要があります。<atom:title>
。pageName が存在しない場合は null にできません。正規化では、空白文字は削除されて「-」になり、a-z, A-Z, 0-9, -, _
に一致しない文字は削除されます。
たとえば「Custom_Page2」であれば、サーバーでは許可されます。
サブページを作成する
親ページの下にサブページ(子)を作成するには、新しい Atom エントリに <link rel="http://schemas.google.com/sites/2008#parent">
を含めます。リンクの href
属性を親エントリのセルフリンクに設定します。
この例では、エントリ ID PARENT_ENTRY_ID
を持つ親お知らせページの下に、見出し「announcement」の新しい announcement
を作成します。ページ本文の XHTML コンテンツもこれに含まれます。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 470 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#announcement" label="announcement"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/> <title>announcement</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div> </content> </entry>
ページ テンプレート
ページ テンプレートの作成
ページ テンプレートを作成するプロセスは、新しいアイテム/ページの作成とサブページの作成と同じです。違いは、キーワードおよびラベルをそれぞれ「http://schemas.google.com/g/2005#template」と「template」に設定した category
を追加する点です。
この例では、新しい webpage
テンプレートを作成します。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 464 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <category scheme="http://schemas.google.com/g/2005#labels" term="http://schemas.google.com/g/2005#template" label="template"/> <title>Webpage Template</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div> </content> </entry>
テンプレートからページを作成する
ページ テンプレートの作成と同様に、ページ テンプレートのセルフリンクを指す rel='http://schemas.google.com/sites/2008#template' を指定して <link>
を含めることで、テンプレートから新しいページをインスタンス化できます。
この例では、ファイル キャビネットを定義する既存のページ テンプレートから、新しい filecabinet
ページを作成します。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 464 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/> <title>File Cabinet Page From Template</title> <link rel='http://schemas.google.com/sites/2008#template' type='application/atom+xml' href='https://sites.google.com/feeds/content/domainName/siteName/ENTRY_ID'/> </entry>
注: <category>
を定義するテンプレートがあるにもかかわらず、エントリにはテンプレートを含める必要があります。また、<content>
要素を追加すると、サーバーはその要素を拒否します。
ファイルのアップロード
Google サイトと同様に、API を使用すると、ファイル キャビネット ページや親ページに添付ファイルをアップロードできます。
親に添付ファイルをアップロードするには、コンテンツ フィードの URL に HTTP POST
リクエストを送信します。
https://sites.google.com/feeds/content/domainName/siteName
ファイル コンテンツと添付ファイルのメタデータを含む <atom:entry>
を組み合わせるには、POST
本文を MIME マルチパート リクエストにする必要があります。<atom:entry>
は、アタッチメントが作成される場所を指定するために、親エントリのセルフリンクを参照する必要があります。詳しくは、サブページを作成するをご覧ください。
添付ファイルをアップロード中
ID が PARENT_ENTRY_ID
のファイル キャビネットに PDF ファイルをアップロードする例を次に示します。添付ファイルは「PDF File」というタイトルで作成され、説明は「HR パケット」(省略可)になります。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 7221984 Content-Type: multipart/related; boundary=END_OF_PART --END_OF_PART Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#attachment" label="attachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/> <title>PDF File</title> <summary>HR packet</summary> </entry> --END_OF_PART Content-Type: application/pdf ... pdf contents here ... --END_OF_PART--
アップロードが成功すると、サーバーは 201 Created
と、新しく作成された添付ファイル エントリのコピーを返します。
フォルダへの添付ファイルのアップロード
添付ファイルを filecabinet
の既存のフォルダにアップロードするには、カテゴリを追加し、「term」属性にフォルダ名を設定します。
<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">
ウェブの添付ファイル
ウェブ添付ファイルは、特別な種類の添付ファイルです。基本的には、ファイル キャビネット リストに追加できるウェブ上の他のファイルへのリンクです。この機能は、Google サイト管理画面の [URL でファイルを追加] アップロード方法に類似しています。
注: ウェブ添付ファイルはファイル キャビネットの中にのみ作成できます。他のタイプのページにはアップロードできません。
この例では、ID FILECABINET_ENTRY_ID
で参照されるファイル キャビネットの下に webattachment
を作成します。タイトルと説明(オプション)は、それぞれ「GoogleLogo」と「nice colors」に設定されています。
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: application/atom+xml Content-Length: 531 <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webattachment" label="webattachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/FILECABINET_ENTRY_ID"/> <title>GoogleLogo</title> <summary>nice colors</summary> <content type="image/gif" src="http://www.google.com/images/logo.gif"></content> </entry>
POST
は、ユーザーのファイル キャビネットに「http://www.google.com/images/logo.gif」の画像を指すリンクを作成します。
コンテンツの更新
どのページのメタデータ(タイトル、pageName など)とページ コンテンツでも、edit
リンクに対する PUT
リクエストを 1 回するだけで編集できます。リクエストの本文には、更新するページを記述する Atom エントリを含める必要があります。このルールの例外は添付ファイルのエントリです。このエントリは添付ファイルのメタデータの更新にのみ使用できます。添付ファイルの内容を変更するには、元データを PUT
リクエストの本文として添付ファイルの edit-media
リンクに含めます。MIME マルチパート リクエストを使用して、メタデータと添付ファイルの両方を一度に更新することもできます。
更新によって別のクライアントの変更を上書きしないことを表明するには、元のエントリの ETag 値を含めます。これを行うには、HTTP If-Match
ヘッダーで ETag 値を指定するか、更新されたエントリに元のエントリの gd:etag
属性を含めます。元のエントリの ETag 値を確認するには、<entry>
要素の gd:etag
属性を調べます。メディア エントリの場合、edit-media
リンクの gd:etag
属性でメディアの ETag を利用できます。
取得した後に他のユーザーがエントリを更新したかどうかにかかわらず、エントリを更新する場合は、If-Match: *
を使用し、ETag を含めないでください。ETag の詳細については、Google Data API リファレンス ガイドをご覧ください。
アイテムのメタデータや HTML コンテンツの更新
エントリのメタデータや HTML コンテンツを更新するには、HTTP PUT
をエントリの edit
リンクに送信します。
次に、listpage
エントリ(ID ENTRY_ID
で表される)を次のように変更して更新する例を示します。
- タイトルが「更新されたコンテンツ」に変更されている
- HTML コンテンツの更新
- リストの最初の列見出しが「オーナー」に変更されました
- ページの URL パスが
<sites:pageName>
要素によって変更されている
PUT /feeds/content/domainName/siteName/ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 816 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"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>
注: エントリ(サーバーから返される)には、上記の例よりも多くの要素が含まれます。
添付ファイルのコンテンツを置き換える
次に、アタッチメントの内容を置き換え、メタデータを変更しない例を示します。リクエストに新しいコンテンツが含まれているため、添付ファイルのエントリの edit-media
リンクが使用されます。
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 70581 Content-Type: application/msword ... doc contents here ...
添付ファイルのメタデータとコンテンツの更新
以下に、添付ファイルのメタデータとそのコンテンツの両方を同時に更新する例を示します。添付ファイルの名前は「New Title」に更新され、その内容は .zip ファイルの内容に置き換えられます。リクエストに新しいファイル コンテンツが含まれているため、添付ファイルのエントリの edit-media
リンクが使用されます。
なお、メタデータに ETag を含めると、メディア コンテンツにも暗黙的な If-Match
が設定されます。これは、メディア コンテンツが更新されるとメタデータの ETag も変更されるためです。
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: multipart/related; boundary="END_OF_PART" --END_OF_PART Content-Type: application/atom+xml <?xml version='1.0' encoding='UTF-8'?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq"> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/ATTACHMENT_ENTRY_ID"/> <title>New Title</title> </entry> --END_OF_PART Content-Type: application/zip ... zip contents here ... --END_OF_PART
コンテンツの削除
Google サイトからアイテムを削除するには、まずエントリを取得してから、エントリの edit
URL に DELETE
リクエストを送信します。これは、アイテムのメタデータや HTML コンテンツを更新するときに使用する URL と同じです。
DELETE /feeds/content/domainName/siteName/ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> If-Match: <ETag or * here>
エントリが正常に削除されると、サーバーは HTTP 200 OK
を返します。
取得後に別のクライアントによって変更されたエントリを削除しないようにするには、元のエントリの ETag 値を含む HTTP If-Match
ヘッダーを含めます。元のエントリの ETag 値は、<entry>
要素の gd:etag
属性で確認できます。
エントリを取得した後で他のユーザーがエントリを更新したかどうかにかかわらず、エントリを削除する場合は、If-Match: *
を使用し、ETag を含めないでください。(この場合、エントリを削除する前にエントリを取得する必要はありません)。
ETag の詳細については、Google Data API リファレンス ガイドをご覧ください。
添付ファイルをダウンロードしています
添付ファイルのエントリを作成したら、認証された HTTP GET
をエントリの <content>
src リンクに送信して、ファイルをダウンロードできます。PDF コンテンツのリンクの例:
<content type="application/pdf" src="http://502377765-a-google-com-s-sites.googlegroups.com/feeds/media/content/domainName/siteName/678942036"/>
ACL フィード
共有権限(ACL)の概要
ACL フィード内の各 ACL エントリは、特定のエンティティのアクセスロールを表します。アクセスロールとは、ユーザー、ユーザー グループ、ドメイン、デフォルトのアクセス(公開サイト)のいずれかです。エントリは、明示的なアクセス権を持つエンティティに対してのみ表示されます。Google サイトの UI の共有画面の [アクセス権を持つユーザー] パネルに、メールアドレスごとに 1 つのエントリが表示されます。したがって、サイトへの暗黙的なアクセス権がある場合でも、ドメイン管理者は表示されません。
ロール
ロール要素は、エンティティが持つことができるアクセスレベルを表します。gAcl:role
要素で使用できる値は次の 4 つです。
- Reader - 閲覧者(読み取り専用権限と同等)。
- writer - 共同編集者(読み取り/書き込みアクセスと同等)。
- owner - 通常はサイト管理者(読み取り/書き込みアクセス権と同等)。
スコープ
スコープ要素は、このアクセスレベルを持つエンティティを表します。gAcl:scope
要素には次の 5 つのタイプがあります。
- user - メールアドレスの値(例: 「user@gmail.com」)。
- group - Google グループのメールアドレス(「group@domain.com」など)。
- domain - G Suite ドメイン名(「domain.com」など)。
- Invite - サイトに招待されているが、サイトの ACL にまだ追加されていないユーザー。(Apigee 1.3 以下が指定されている場合は使用できません)。
- default - 「default」タイプのスコープは 1 つだけあり、値を持ちません(例:
<gAcl:scope type="default">
)。このスコープは、公開サイトでのユーザーのデフォルト アクセスを制御します。
注: ドメインは、gAcl:role
値を「オーナー」アクセス権に設定することはできません。アクセスできるのはリーダーまたはライターのみです。
「招待」スコープについて。
Google アカウントをまだ持っていない 1 人以上のユーザーを ACL に追加すると、API は招待スコープを返します。API からトークンが埋め込まれた URL が返されます。招待されたユーザーが招待を承諾できるようにするには、このトークンを提供する必要があります。
この招待方法では、使用するメールアドレスを事前に把握していなくても Google 以外のユーザーを招待できます。ユーザーはトークンが埋め込まれた招待 URL をクリックすれば、任意のメールアドレスを使用して登録できます。また、この URL を使用すると複数のユーザーが招待を承諾できるため、これは 1 人またはユーザー グループを招待する場合に便利です。
注: 「invite」スコープは、Apigee バージョン 1.4 以降でのみ使用できます。1.3 以下を明示的に指定している場合、これは機能しません。
ACL フィードの取得
ACL フィードは、サイトの共有権限の管理に使用でき、次の URI でアクセスできます。
https://sites.google.com/feeds/acl/site/domainName/siteName
フィード パラメータ | 説明 |
---|---|
domainName | 「site 」、または G Suite でホストされているドメイン(例: example.com )です。 |
siteName | サイトのウェブスペース名。サイトの URL に含まれています(例: myCoolSite )。 |
なお、サイトフィードの各エントリには、このフィードへのリンクが含まれています。
<link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
サイトの共有権限を取得するには、HTTP GET
を ACL フィード URI に送信します。
GET /feeds/acl/site/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here>
サーバーは 200 OK
と ACL エントリのフィードを返します。
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/acl/site/domainName/siteName</id> <updated>2009-12-03T22:01:05.963Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <title>Acl</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName"/> <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40gmail.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/> <gAcl:scope type="user" value="userA@google.com"/> <gAcl:role value="owner"/> </entry> <entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/> <gAcl:scope type="user" value="userB@gmail.com"/> <gAcl:role value="writer"/> </entry> <entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/> <gAcl:scope type="user" value="userC@gmail.com"/> <gAcl:role value="reader"/> </entry> ... </feed>
サイトの共有
ACL フィードは、GET
、POST
、PUT
のリクエストを受け入れます。ACL フィードに新しい役割を挿入するには、サイトの ACL フィードに POST
リクエストを発行します。
注: 一部の共有 ACL は、その権限を許可するようにドメインが構成されている場合にのみ使用できます(たとえば、G Suite ドメインのドメイン外部との共有が有効になっている場合)。
この例では、新しい共同編集者(ライター)をサイトに追加します。
POST /feeds/acl/site/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/> <gAcl:role value='writer'/> <gAcl:scope type='user' value='new_writer@example.com'/> </entry>
挿入が成功すると、201 Created
と新しいエントリが返されます。
<entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/> <gAcl:role value='writer'/> <gAcl:scope type='user' value='new_writer@example.com'/> </entry>
「招待」スコープでユーザーを招待する
Google アカウントを持っていないユーザーを追加した場合、API から返される URL を、招待したいユーザーに提供する必要があります。URL をクリックすると、既存のアカウントでログインするか、新しいアカウントを作成して、サイトにアクセスできるようになります。
招待が成功すると、201 Created
と、ユーザーに渡す必要がある URL を含む新しいエントリが返されます。
<entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="http://schemas.google.com/sites/2008#invite" type="text/html"href="domainName/siteName?invite=inviteToken"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/> <gAcl:role value='writer'/> <gAcl:scope type='invite' value='new_invite%40example.com'/> </entry>
グループレベルとドメインレベルでの共有
1 人のユーザーとサイトを共有する場合と同様に、Google グループまたは G Suite ドメイン間でサイトを共有できます。必要な scope
値を以下に示します。
グループのメールアドレスと共有:
<gAcl:scope type="group" value="group@example.com"/>
ドメイン全体で共有:
<gAcl:scope type="domain" value="example.com"/>
ドメインレベルでの共有は、G Suite ドメインのみで、サイトがホストされているドメインでのみサポートされます。たとえば、http://sites.google.com/a/domain1.com/siteA は、ドメイン全体を domain2.com と共有できず、domain2.com とのみ共有できます。G Suite ドメイン(例: http://sites.google.com/site/siteB)にホストされていないサイトはドメインを招待できません。
共有権限を変更しています
ACL エントリを更新するには、必要に応じてエントリを変更し、エントリの edit
リンクに HTTP PUT
リクエストを送信します。これは単なる <link>
要素で、「rel」属性が「edit」に設定されています。上の例では、このリンクは次のようになります。
<link rel='edit' type='application/atom+xml' href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>
以下のスニペットでは、new_writer@gmail.com
のロールを「Reader」に変更しています。
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>
共有権限を削除しています
このユーザーの権限を削除するには、PUT
リクエストで使用したものと同じ edit
リンクに対して DELETE
リクエストを発行します。
DELETE /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here>
サーバーは 200 OK
で応答します。
特別なトピック
フィードまたはエントリを再度取得する
以前に取得したフィードやエントリを取得する場合は、前回取得してから変更されている場合にのみリストまたはエントリを送信するようにサーバーに伝えることで、効率を向上できます。
この種の条件付き取得を行うには、HTTP If-None-Match
ヘッダーを含む HTTP GET
リクエストを送信します。ヘッダーにリストまたはエントリの ETag を指定します。これは、<feed>
要素または <entry>
要素の gd:etag
属性で確認できます。
サイトフィードの使用例:
GET /feeds/site/domainName/myOtherTestSite/ GData-Version: 1.4 If-None-Match: W/"Ck8GQXk7fil7ImA9WxNSFk0."
サーバーはこのリクエストを受信すると、リクエストされたアイテムが指定された ETag と同じ ETag を持つかどうかを確認します。ETag が一致していれば、アイテムは変更されておらず、サーバーは HTTP 304 Not Modified
ステータス コードまたは HTTP 412 Precodition Failed
ステータス コードを返します。どちらのステータス コードも、すでに取得したアイテムが最新であることを示します。
ETag が一致しない場合は、前回リクエストした後にアイテムが変更されているため、サーバーからそのアイテムが返されます。
ETag の詳細については、Google Data API リファレンス ガイドをご覧ください。
バッチ処理
バッチ リクエストを使用すると、クライアントは各オペレーションを個別に送信するのではなく、1 つのリクエストで複数のオペレーションを実行できます。
サーバーはリクエストされた変更をできるだけ多く実行し、各オペレーションの成功または失敗の評価に使用できるステータス情報を返します。Google Data API でのバッチ処理について詳しくは、Google Data API を使用したバッチ処理をご覧ください。
バッチフィードのすべてのオペレーション(挿入オペレーションを除く)に <id> 要素があります。この要素は、コンテンツ フィードを更新、削除、またはクエリするときに通常使用するリクエスト URL と同じです。
たとえば、編集を更新する場合は、<id> を該当のエントリの edit
リンクに設定します。ターゲット エントリを識別するために使用されます。新しいエントリは、まだ作成されていないため、<id> 要素を持ちません。代わりに、<batch:id> に文字列値を定義すると、サーバーのレスポンスで返され、対応するエントリの検索に使用されます。
バッチ リクエストを実行するには、バッチフィードを作成し、HTTP POST
をフィードのバッチリンクに送信します。
<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="https://sites.google.com/feeds/content/site/siteName/batch"/>
次の例は、ウェブページのエントリに対してクエリを実行、挿入、更新、削除する方法を示しています。
POST /feeds/content/site/siteName/batch HTTP/1.1 Host: sites.google.com Accept: */* If-Match: * GData-Version: 1.4 Authorization: <your authorization header here> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:batch='http://schemas.google.com/gdata/batch'> <entry> <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id> <batch:operation type="query"/> </entry> <entry> <batch:id>1</batch:id> <batch:operation type='insert'/> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>New Webpage1</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div> </content> </entry> <entry gd:etag=""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>
返されるフィードには、操作ごとに 1 つの結果エントリが含まれます。
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
<updated>2009-11-10T22:44:08.369Z</updated>
<title>Batch Feed</title>
<entry gd:etag=""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>