기존 Google Sites API를 사용하면 애플리케이션이 Google Sites 내의 콘텐츠에 액세스하고, 콘텐츠를 게시하고, 콘텐츠를 수정할 수 있습니다. 또한 애플리케이션은 최근 활동 목록을 요청하고, revisionhistory를 가져오고, 첨부파일과 파일을 업로드/다운로드할 수 있습니다.
잠재고객
이 문서에서는 Google Data API 프로토콜의 일반적인 개념을 이해하고 있다고 가정합니다.
이 문서는 Google Sites와 상호작용할 수 있는 클라이언트 애플리케이션을 작성하려는 프로그래머를 대상으로 합니다. 원시 XML/HTTP를 사용한 기본 데이터 API 상호작용의 일련의 예시를 설명과 함께 제공합니다. 이 문서를 읽은 후 왼쪽 탐색 메뉴의 다른 가이드에 있는 언어별 예시를 읽어 클라이언트 라이브러리를 사용하여 API와 상호작용하는 방법을 자세히 알아볼 수 있습니다.
이 가이드의 자료에 대한 참조는 참조 가이드를 확인하세요.
요청 승인
애플리케이션에서 비공개 사용자 데이터를 요청할 때는 인증 토큰을 포함해야 합니다. Google은 이 토큰을 사용하여 애플리케이션을 식별합니다.
승인 프로토콜 정보
요청을 승인하려면 애플리케이션에서 OAuth 2.0을 사용해야 합니다. 다른 승인 프로토콜은 지원되지 않습니다. 애플리케이션에서 Google 계정으로 로그인을 사용하는 경우, 승인의 일부 절차는 자동으로 처리됩니다.
OAuth 2.0을 사용하여 요청 승인하기
Google Sites Data API에 대한 비공개 사용자 데이터 요청은 인증된 사용자가 승인해야 합니다.
OAuth 2.0의 세부적인 승인 절차('흐름')는 제작 중인 애플리케이션 종류에 따라 약간씩 다릅니다. 다음의 일반적인 과정은 모든 애플리케이션 유형에 적용됩니다.
- 애플리케이션을 만들 때 Google API 콘솔을 사용하여 애플리케이션을 등록합니다. 이렇게 하면 Google에서 클라이언트 ID 및 클라이언트 보안 비밀과 같이 나중에 필요한 정보를 제공합니다.
- Google API 콘솔에서 Google Sites Data API를 활성화합니다. API 콘솔의 목록에 이 API가 없다면 이 단계를 건너뜁니다.
- 애플리케이션에서 사용자 데이터에 액세스해야 하는 경우 Google에 특정 액세스 범위를 요청합니다.
- 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 Sites Data API에 대한 모든 요청은 버전 1.4를 지정해야 합니다. 버전 번호를 지정하려면 GData-Version HTTP 헤더를 사용합니다.
GData-Version: 1.4
또는 HTTP 헤더를 설정할 수 없는 경우 URL에서 v=1.4을 쿼리 매개변수로 지정할 수 있습니다. 하지만 가능한 경우 HTTP 헤더를 사용하는 것이 좋습니다.
참고: 클라이언트 라이브러리는 적절한 버전 헤더를 자동으로 제공하므로 클라이언트 라이브러리를 사용하는 경우 v=1.4 쿼리 매개변수를 사용하지 마세요.
사이트 피드
사이트 피드를 사용하면 사용자가 소유하거나 보기 권한이 있는 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 아래에 'slate' 테마를 사용하여 새 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 Sites 설정 페이지에서 '이 사이트를 템플릿으로 게시' 설정이 선택되어 있으면 사이트가 템플릿입니다.
- 소스 사이트의 소유자로 등록되어 있는 경우 다른 도메인에서 사이트를 복사할 수 있습니다.
사이트의 메타데이터 업데이트
사이트의 제목이나 요약을 업데이트하려면 사이트 항목의 edit 링크에 HTTP PUT를 보냅니다.
예를 들어 다음 예에서는 이전 사이트의 제목을 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 사이트에는 도메인 내 사이트를 분류하는 데 유용한 카테고리 메타 데이터가 포함됩니다. 카테고리 메타 데이터를 추가하거나 업데이트하려면 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>
이 예에서는 기존 사이트를 수정하고 '팀 사이트' 카테고리를 추가합니다.
<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>
이 예에서는 '팀 사이트'와 '법무팀'이라는 두 가지 카테고리를 추가합니다.
웹 주소 매핑
웹 주소 매핑을 사용하면 사이트 사용자가 자신의 도메인을 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을 가리키는 webAddressMapping이 세 개 있습니다.
웹 주소 매핑 수정
참고: 웹 주소 매핑을 사용할 때는 모든 GET/POST/PUT 작업에서 with-mappings=true 매개변수를 지정해야 합니다. 매개변수가 없으면 webAddressMapping이 사이트 항목 (GET)에 반환되지 않거나 항목에서 매핑을 업데이트/삭제 (PUT)할 때 고려되지 않습니다.
매핑을 추가, 업데이트 또는 삭제하려면 새 사이트를 만들 때 또는 사이트의 메타데이터를 업데이트할 때 해당 링크를 지정, 변경 또는 삭제하면 됩니다. with-mappings=true 매개변수는 사이트 피드 URI에 포함되어야 합니다.
참고: 주소 매핑을 업데이트하려면 사이트 관리자 또는 G Suite 호스팅 사이트의 경우 도메인 관리자여야 합니다.
예를 들어 아래 요청은 http://www.mysitemapping.com 매핑을 http://www.my-new-sitemapping.com로 업데이트하고 항목에서 링크를 제외하여 http://www.mysitemapping2.com를 삭제합니다.
PUT /feeds/site/domainName?with-mappings=true HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry gd:etag="W/"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>
웹 주소 매핑은 사이트를 만들거나 복사할 때도 지정할 수 있습니다.
활동 피드
활동 피드를 가져와 사이트의 최근 활동 (변경사항)을 가져올 수 있습니다. 활동 피드의 각 항목에는 사이트에 적용된 변경사항에 관한 정보가 포함됩니다.
활동 피드를 쿼리하려면 활동 피드 URL에 HTTP GET를 보냅니다.
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 헤더를 전송하고 요청 승인에서 획득한 토큰을 참조해야 합니다.
콘텐츠 피드
콘텐츠 가져오기
콘텐츠 피드에는 사이트의 현재 콘텐츠가 나열됩니다. 다음 URL로 인증된 GET 요청을 보냅니다.
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 데이터 프로토콜 참조를 참고하세요.
기존 Sites API에 특정 의미를 갖는 요소는 아래에 설명되어 있습니다. 특정 종류 항목에는 추가 속성이 있지만 (아래에 나열되지 않음) 다른 항목에는 없습니다. 예를 들어 listitem 항목에는 <gs:field> 요소가 있을 수 있지만 webpage 항목에는 없을 수 있습니다.
| 요소 | 설명 |
|---|---|
<content ...> | 내부 텍스트는 페이지의 HTML 본문입니다. 일부 항목 (예: 첨부파일)의 경우 이 요소에는 파일을 가리키는 src 속성이 포함됩니다. |
<link rel="alternate" ...> | Google Sites의 페이지 또는 항목 링크 |
<link rel="http://schemas.google.com/sites/2008#revision" ...> | href 속성이 항목의 수정사항 피드를 가리킵니다. |
<link rel="http://schemas.google.com/sites/2008#parent" ...> | href 속성은 항목의 상위 항목을 가리킵니다. |
<link rel="http://schemas.google.com/sites/2008#template" ...> | href 속성은 항목의 템플릿 페이지를 가리킵니다. |
<category scheme="http://schemas.google.com/g/2005#kind" ...> | label은 항목의 유형입니다. |
<category term="http://schemas.google.com/g/2005#template" ...> | label=template: 항목이 템플릿임을 나타냅니다. |
<gd:feedLink> | href 속성은 항목의 상위 항목의 하위 항목을 가리킵니다. |
<sites:pageName> | 페이지의 웹 스페이스 이름입니다. 페이지 URL의 이름에 해당합니다. |
<sites:revision> | 현재 버전 번호입니다. |
콘텐츠 피드 쿼리 예시
표준 Google Data API 쿼리 매개변수와 기존 Sites 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을 포함하고, 제목을 '새 웹페이지 제목'으로 설정합니다.
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 아래에 생성되고 페이지 제목은 'New Webpage Title'이 됩니다. 즉, URL의 <atom:title>이 new-webpage-title로 정규화됩니다.
페이지의 URL 경로를 맞춤설정하려면 <sites:pageName> 요소를 설정하면 됩니다.
이 예시에서는 페이지 제목이 '파일 저장소'인 새 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 Sites와 마찬가지로 API를 사용하면 파일 보관함 페이지와 상위 페이지에 첨부파일을 업로드할 수 있습니다.
상위 항목에 첨부파일을 업로드하려면 콘텐츠 피드 URL에 HTTP POST 요청을 보냅니다.
https://sites.google.com/feeds/content/domainName/siteName
POST 본문은 파일 콘텐츠를 첨부파일의 메타데이터가 포함된 <atom:entry>와 결합하는 MIME 멀티파트 요청이어야 합니다. 첨부파일이 생성될 위치를 지정하려면 <atom:entry>이 상위 항목의 자체 링크를 참조해야 합니다.
자세한 내용은 하위 페이지 만들기를 참고하세요.
첨부파일 업로드 중
다음은 ID가 PARENT_ENTRY_ID인 파일 캐비닛에 PDF 파일을 업로드하는 예입니다. 첨부파일은 제목 'PDF 파일'과 설명 (선택사항) 'HR 패킷'으로 생성됩니다.
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 7221984 Content-Type: multipart/related; boundary=END_OF_PART --END_OF_PART Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#attachment" label="attachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/> <title>PDF File</title> <summary>HR packet</summary> </entry> --END_OF_PART Content-Type: application/pdf ... pdf contents here ... --END_OF_PART--
업로드가 성공하면 서버는 201 Created와 새로 생성된 첨부파일 항목의 사본으로 응답합니다.
폴더에 첨부파일 업로드
filecabinet의 기존 폴더에 첨부파일을 업로드하려면 'term' 속성이 폴더 이름으로 설정된 카테고리를 포함하세요.
<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">웹 첨부파일
웹 첨부파일은 특별한 종류의 첨부파일입니다. 기본적으로 웹에 있는 다른 파일로 연결되는 링크이며, 파일 캐비닛 목록에 추가할 수 있습니다. 이 기능은 Google 사이트 도구 UI의 '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'의 이미지를 가리키는 링크를 사용자의 파일 보관함에 만듭니다.
콘텐츠 업데이트
edit 링크에 대한 단일 PUT 요청으로 모든 페이지의 메타데이터 (제목, pageName 등)와 페이지 콘텐츠를 수정할 수 있습니다.
요청 본문에는 업데이트된 페이지를 설명하는 Atom 항목이 포함되어야 합니다. 이 규칙의 예외는 첨부파일 항목입니다. 이 경우 항목은 첨부파일의 메타데이터를 업데이트하는 데만 사용할 수 있습니다.
첨부 파일의 콘텐츠를 변경하려면 첨부파일의 edit-media 링크에 대한 PUT 요청의 본문으로 원시 데이터를 포함하면 됩니다. MIME 멀티파트 요청을 사용하여 메타데이터와 첨부 파일 콘텐츠를 한 번에 업데이트할 수도 있습니다.
업데이트가 다른 클라이언트의 변경사항을 덮어쓰지 않음을 어설션하려면 원래 항목의 ETag 값을 포함하세요. HTTP If-Match 헤더에 ETag 값을 제공하거나 업데이트된 항목에 원래 항목의 gd:etag 속성을 포함하면 됩니다. 원래 항목의 ETag 값을 확인하려면 <entry> 요소의 gd:etag 속성을 검사합니다.
미디어 항목의 경우 미디어의 ETag가 edit-media 링크의 gd:etag 속성에서 제공될 수 있습니다.
가져온 후 다른 사용자가 업데이트했는지 여부와 관계없이 항목을 업데이트하려면 If-Match: *를 사용하고 ETag를 포함하지 마세요. ETag에 대한 자세한 내용은 Google Data API 참조 가이드를 참고하세요.
상품의 메타데이터 또는 HTML 콘텐츠 업데이트
항목의 메타데이터 또는 HTML 콘텐츠를 업데이트하려면 항목의 edit 링크에 HTTP PUT를 전송합니다.
다음은 다음 변경사항으로 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="Description"/> <gs:column index="C" name="Completed"/> </gs:data> <sites:pageName>newPagePath</sites:pageName> </entry>
참고: 항목 (서버에서 반환됨)에는 위의 예보다 많은 요소가 포함됩니다.
첨부파일 콘텐츠 바꾸기
다음은 첨부파일의 콘텐츠를 바꾸되 메타데이터는 변경하지 않는 예입니다. 요청에 새 콘텐츠가 포함되어 있으므로 첨부파일 항목의 edit-media 링크가 사용됩니다.
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 70581 Content-Type: application/msword ... doc contents here ...
첨부파일 메타데이터 및 콘텐츠 업데이트
아래는 첨부파일의 메타데이터와 콘텐츠를 동시에 업데이트하는 예입니다. 첨부파일 이름이 '새 제목'으로 업데이트되고 콘텐츠가 .zip 파일의 콘텐츠로 대체됩니다. 요청에 새 파일 콘텐츠가 포함되어 있으므로 첨부파일 항목의 edit-media 링크가 사용됩니다.
메타데이터의 ETag를 포함하면 미디어 콘텐츠의 암시적 If-Match도 제공됩니다. 미디어 콘텐츠가 업데이트되면 메타데이터의 ETag가 변경되기 때문입니다.
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: multipart/related; boundary="END_OF_PART" --END_OF_PART Content-Type: application/atom+xml <?xml version='1.0' encoding='UTF-8'?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq"> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/ATTACHMENT_ENTRY_ID"/> <title>New Title</title> </entry> --END_OF_PART Content-Type: application/zip ... zip contents here ... --END_OF_PART
콘텐츠 삭제
Google 사이트에서 항목을 삭제하려면 먼저 항목을 가져온 다음 항목의 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 헤더를 포함하세요. <entry> 요소의 gd:etag 속성을 검사하여 원래 항목의 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 Sites UI의 공유 화면에 있는 '액세스 권한이 있는 사용자' 패널의 각 이메일 주소에 대해 하나의 항목이 표시됩니다. 따라서 도메인 관리자는 사이트에 대한 암시적 액세스 권한이 있더라도 표시되지 않습니다.
역할
역할 요소는 항목이 가질 수 있는 액세스 수준을 나타냅니다. gAcl:role 요소에는 다음 네 가지 값이 가능합니다.
- reader - 뷰어 (읽기 전용 액세스와 동일)
- writer: 공동작업자 (읽기/쓰기 액세스 권한과 동일)
- owner - 일반적으로 사이트 관리자 (읽기/쓰기 액세스 권한과 동일)입니다.
범위
범위 요소는 이 액세스 수준을 갖는 항목을 나타냅니다. gAcl:scope 요소에는 다음과 같은 5가지 유형이 있습니다.
- user - 이메일 주소 값입니다(예: 'user@gmail.com').
- group: Google 그룹 이메일 주소(예: 'group@domain.com')
- domain: G Suite 도메인 이름(예: 'domain.com')
- invite: 사이트에 초대되었지만 아직 사이트의 ACL에 추가되지 않은 사용자입니다. (gdata 1.3 이하가 지정된 경우에는 사용할 수 없음)
- default - 값(예:
<gAcl:scope type="default">)이 없는 'default' 유형의 가능한 범위는 하나뿐입니다. 이 특정 범위는 사용자가 공개 사이트에서 기본적으로 갖는 액세스를 제어합니다.
참고: 도메인은 gAcl:role 값이 '소유자' 액세스로 설정될 수 없으며, 독자 또는 작성자만 될 수 있습니다.
'invite' 범위에 관한 내용입니다.
Google 계정이 아직 없는 사용자를 ACL에 하나 이상 추가하면 API에서 초대 범위를 반환합니다. API는 초대를 수락할 수 있도록 초대된 사용자에게 제공해야 하는 토큰이 삽입된 URL을 반환합니다.
이 초대 방법을 사용하면 사용할 이메일 주소를 미리 알지 못해도 Google 이외의 사용자를 초대할 수 있습니다. 사용자가 토큰이 삽입된 초대 URL을 클릭하는 한 원하는 이메일 주소를 사용하여 액세스 권한을 신청할 수 있습니다. 또한 여러 사용자가 이 URL을 사용하여 초대를 수락할 수 있으므로 한 명의 사용자 또는 사용자 그룹을 초대하는 경우 유용합니다.
참고: 'invite' 범위는 gdata 버전 1.4 이상에서만 사용할 수 있습니다. 1.3 이하를 명시적으로 지정하는 경우에는 작동하지 않습니다.
ACL 피드 가져오기
ACL 피드는 사이트의 공유 권한을 제어하는 데 사용할 수 있으며 다음 URI를 통해 액세스할 수 있습니다.
https://sites.google.com/feeds/acl/site/domainName/siteName
| 피드 매개변수 | 설명 |
|---|---|
domainName | 'site' 또는 G Suite 호스팅 도메인의 도메인 (예: example.com) |
siteName | 사이트의 웹스페이스 이름입니다. 사이트의 URL (예: myCoolSite)에서 확인할 수 있습니다. |
사이트 피드의 각 항목에는 이 피드로 연결되는 링크가 포함되어 있습니다.
<link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
사이트의 공유 권한을 가져오려면 ACL 피드 URI에 HTTP GET를 전송하세요.
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>
'invite' 범위로 사용자 초대
Google 계정이 없는 사용자를 추가하면 API는 초대할 사용자에게 제공해야 하는 URL을 반환합니다. URL을 클릭한 후 기존 계정으로 로그인하거나 새 계정을 만들어 사이트에 액세스할 수 있습니다.
초대가 성공하면 201 Created와 사용자에게 전달해야 하는 URL이 포함된 새 항목이 반환됩니다.
<entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="http://schemas.google.com/sites/2008#invite" type="text/html"href="domainName/siteName?invite=inviteToken"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/> <gAcl:role value='writer'/> <gAcl:scope type='invite' value='new_invite%40example.com'/> </entry>
그룹 및 도메인 수준 공유
단일 사용자와 사이트를 공유하는 것과 마찬가지로 Google 그룹 또는 G Suite 도메인에서 사이트를 공유할 수 있습니다. 필요한 scope 값은 아래에 나열되어 있습니다.
그룹 이메일 주소로 공유하는 경우:
<gAcl:scope type="group" value="group@example.com"/>
전체 도메인에 공유:
<gAcl:scope type="domain" value="example.com"/>
도메인 수준 공유는 G Suite 도메인에서만 지원되며 사이트가 호스팅된 도메인에서만 지원됩니다. 예를 들어 http://sites.google.com/a/domain1.com/siteA는 domain2.com이 아닌 domain1.com과만 전체 사이트를 공유할 수 있습니다. G Suite 도메인에서 호스팅되지 않는 사이트 (예: http://sites.google.com/site/siteB)는 도메인을 초대할 수 없습니다.
공유 권한 수정
ACL 항목을 업데이트하려면 필요에 따라 항목을 수정하고 항목의 edit 링크에 HTTP PUT 요청을 실행합니다. 이 링크는 'rel' 속성이 'edit'으로 설정된 <link> 요소입니다. 이전 예시의 경우 링크는 다음과 같습니다.
<link rel='edit' type='application/atom+xml'
href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>아래 스니펫은 new_writer@gmail.com의 역할을 '읽기 권한 사용자'로 변경합니다.
PUT /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/> <gAcl:role value='reader'/> <gAcl:scope type='user' value='new_writer@gmail.com'/> </entry>
공유 권한 삭제
이 사용자의 권한을 삭제하려면 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를 지정합니다. 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 참조 가이드를 참고하세요.
일괄 처리
일괄 요청을 사용하면 클라이언트가 각 작업을 개별적으로 제출하는 대신 하나의 요청으로 여러 작업을 실행할 수 있습니다.
서버는 요청된 변경사항을 최대한 많이 실행하고 각 작업의 성공 또는 실패를 평가하는 데 사용할 수 있는 상태 정보를 반환합니다. 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>
반환된 피드에는 각 작업에 대한 결과 항목이 하나씩 포함됩니다.
<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>