기존 Google Sites API를 사용하면 애플리케이션에서 Google Sites 내의 콘텐츠에 액세스하고 콘텐츠를 게시 및 수정할 수 있습니다. 또한 애플리케이션에서 최근 활동 목록을 요청하고 업데이트 기록을 가져오고 첨부파일 및 파일을 업로드/다운로드할 수 있습니다.
시청자층
이 문서에서는 사용자가 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 Sites를 표시하고 기존 사이트의 제목을 수정할 수 있습니다. G Suite 도메인의 경우 전체 사이트를 만들거나 복사하는 데 사용할 수도 있습니다.
사이트 나열
사용자가 액세스할 수 있는 사이트를 나열하려면 다음 URL에 인증된 GET
요청을 보냅니다.
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 Sites로 사이트를 만듭니다.
사이트의 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>
이 예에서는 '팀 사이트'와 '법무팀'의 두 가지 카테고리를 추가합니다.
웹 주소 매핑
웹 주소 매핑을 사용하면 Sites 사용자가 자신의 도메인을 Google Sites에 매핑할 수 있습니다. 예를 들어 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)할 때 고려되지 않습니다.
매핑을 추가, 업데이트 또는 삭제하려면 새 사이트를 만들거나 사이트의 메타데이터를 업데이트할 때 이러한 링크를 지정, 변경 또는 삭제하면 됩니다. with-mappings=true
매개변수는 사이트 피드 URI에 포함되어야 합니다.
참고: 주소 매핑을 업데이트하려면 사이트 관리자 또는 도메인 관리자여야 하며, G Suite 호스팅 사이트의 경우에는 도메인 관리자여야 합니다.
예를 들어 아래 요청은 http://www.my-new-sitemapping.com
에 대한 http://www.mysitemapping.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
헤더를 전송하고 요청 승인에서 받은 토큰을 참조해야 합니다.
콘텐츠 피드
콘텐츠 검색
콘텐츠 피드에 사이트 도구의 현재 콘텐츠가 나열됩니다. 인증된 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 데이터 프로토콜 참조를 확인하세요.
기존 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로, 페이지의 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을 포함하며 제목 제목을 '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>
서버는 페이지 우선순위 경로의 이름을 지정하기 위해 다음과 같은 우선순위 규칙을 사용합니다.
<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
를 만듭니다. 페이지 본문의 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를 사용하면 자료실 페이지와 상위 페이지에 첨부파일을 업로드할 수 있습니다.
상위에 첨부파일을 업로드하려면 HTTP POST
요청을 콘텐츠 피드 URL에 전송합니다.
https://sites.google.com/feeds/content/domainName/siteName
POST
본문은 MIME 멀티파트 요청이어야 하며, 파일 콘텐츠를 첨부파일의 메타데이터가 포함된 <atom:entry>
과 결합해야 합니다. <atom:entry>
는 연결이 생성될 위치를 지정하기 위해 상위 항목의 자체 링크를 참조해야 합니다.
자세한 내용은 하위 페이지 만들기를 참고하세요.
첨부파일 업로드 중
다음은 PDF 파일을 ID가 PARENT_ENTRY_ID
인 자료실에 업로드하는 예입니다. 제목이 'PDF 파일'이고 설명 (선택사항)인 'HR 패킷'을 사용하여 첨부파일이 생성됩니다.
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 7221984 Content-Type: multipart/related; boundary=END_OF_PART --END_OF_PART Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#attachment" label="attachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/> <title>PDF File</title> <summary>HR packet</summary> </entry> --END_OF_PART Content-Type: application/pdf ... pdf contents here ... --END_OF_PART--
업로드가 성공하면 서버에서 201 Created
및 새로 만든 첨부파일 항목의 사본을 가지고 응답합니다.
폴더에 첨부파일 업로드
filecabinet
의 기존 폴더에 첨부파일을 업로드하려면 'term' 속성이 폴더 이름으로 설정된 카테고리를 포함하세요.
<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">
웹 첨부파일
웹 첨부파일은 특별한 종류의 첨부파일입니다. 기본적으로 파일 캐비닛 목록에 추가할 수 있는 웹상의 다른 파일로 연결되는 링크입니다. 이 기능은 Google Sites 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
요청으로 모든 페이지의 메타데이터 (제목, 페이지 이름 등)와 페이지 콘텐츠를 수정할 수 있습니다.
요청 본문에는 업데이트된 페이지를 설명하는 Atom 항목이 포함되어야 합니다. 이 규칙의 예외는 첨부파일의 메타데이터를 업데이트하는 용도로만 사용할 수 있는 첨부파일 항목입니다.
첨부파일의 콘텐츠를 변경하려면 첨부파일의 edit-media
링크에 대한 PUT
요청의 본문으로 원시 데이터를 포함하기만 하면 됩니다. 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 콘텐츠
- 목록의 첫 번째 열 제목이 '소유자'로 업데이트됩니다.
<sites:pageName>
요소에 의해 페이지의 URL 경로가 수정됨
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 ...
첨부파일 메타데이터 및 콘텐츠 업데이트
다음은 첨부파일의 메타데이터와 콘텐츠를 동시에 업데이트하는 예입니다. 첨부파일 이름이 '새 제목'으로 업데이트되고 첨부파일 내용이 .zip 파일의 내용으로 대체됩니다. 요청에 새 파일 콘텐츠가 포함되어 있으므로 첨부파일 항목의 edit-media
링크가 사용됩니다.
메타데이터의 ETag를 포함하면 미디어 콘텐츠에 암시적 If-Match
도 제공됩니다. 미디어 콘텐츠를 업데이트하면 메타데이터의 ETag가 변경되기 때문입니다.
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: multipart/related; boundary="END_OF_PART" --END_OF_PART Content-Type: application/atom+xml <?xml version='1.0' encoding='UTF-8'?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq"> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/ATTACHMENT_ENTRY_ID"/> <title>New Title</title> </entry> --END_OF_PART Content-Type: application/zip ... zip contents here ... --END_OF_PART
콘텐츠 삭제
Google Sites에서 항목을 삭제하려면 먼저 항목을 검색한 다음 항목의 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
요소의 가능한 값은 4가지입니다.
- reader — 뷰어 (읽기 전용 액세스 권한과 동일)
- writer — 공동작업자 (읽기/쓰기 액세스 권한과 동일)
- owner —일반적으로 사이트 관리자입니다 (읽기/쓰기 액세스와 동일).
범위
scope 요소는 이 액세스 수준이 있는 항목을 나타냅니다. gAcl:scope
요소에는 다섯 가지 유형이 있습니다.
- user — 이메일 주소 값(예: 'user@gmail.com')입니다.
- group — Google 그룹 이메일 주소(예: 'group@domain.com')입니다.
- domain: G Suite 도메인 이름(예: 'domain.com')입니다.
- 초대 — 사이트에 초대받았지만 아직 사이트의 ACL에 추가되지 않은 사용자입니다. gdata 1.3 이하를 지정한 경우에는 사용할 수 없습니다.
- default - 값이 없는 'default' 유형의 범위 하나만 있을 수 있습니다(예:
<gAcl:scope type="default">
). 이 특정 범위는 기본적으로 모든 사용자가 공개 사이트에 대해 갖는 액세스 권한을 제어합니다.
참고: 도메인에 gAcl:role
값을 '소유자' 액세스로 설정할 수 없으며 리더 또는 작성자만 지정할 수 있습니다.
'초대' 범위에 관한 정보
Google 계정이 없는 사용자를 1명 이상 ACL에 추가하면 API에서 초대 범위를 반환합니다. API는 초대를 받은 사용자가 초대를 수락할 수 있도록 하려면 삽입된 토큰이 포함된 URL을 반환합니다.
이 초대 방법을 통해 Google 계정 사용자가 아닌 사용자는 사용하려는 이메일 주소를 미리 알 수 있습니다. 사용자가 삽입된 토큰이 있는 초대 URL을 클릭하기만 하면 원하는 이메일 주소를 사용하여 액세스에 가입할 수 있습니다. 또한 여러 사용자가 이 URL을 사용하여 초대를 수락할 수 있으므로 단일 사용자 또는 사용자 그룹을 초대할 때 유용할 수 있습니다.
참고: '초대' 범위는 gdata 버전 1.4 이상에서만 사용할 수 있습니다. 1.3 이하를 명시적으로 지정한 경우에는 이 명령어가 작동하지 않습니다.
ACL 피드 검색
ACL 피드는 사이트의 공유 권한을 제어하는 데 사용할 수 있으며 다음 URI를 통해 액세스할 수 있습니다.
https://sites.google.com/feeds/acl/site/domainName/siteName
피드 매개변수 | 설명 |
---|---|
domainName | 'site ' 또는 G Suite에서 호스팅하는 도메인의 도메인 (예: example.com )입니다. |
siteName | 사이트의 URL입니다 (예: myCoolSite ). |
사이트 피드의 각 항목에는 이 피드에 대한 링크가 포함되어 있습니다.
<link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
사이트의 공유 권한을 가져오려면 다음과 같이 HTTP 피드 URI에 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>
'초대' 범위를 통해 사용자 초대
Google 계정이 없는 사용자를 추가하면 API에서 초대하려는 사용자에게 제공해야 하는 URL을 반환합니다. URL을 클릭한 후에는 기존 계정으로 로그인하거나 새 계정을 만들어 사이트에 액세스할 수 있습니다.
초대에 성공하면 사용자에게 전달해야 하는 URL이 포함된 201 Created
및 새 항목이 반환됩니다.
<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과는 공유할 수 없고 domain2.com에는 공유할 수 없습니다. G Suite 도메인에서 호스팅되지 않는 사이트 (예: http://sites.google.com/site/siteB)에는 도메인을 초대할 수 없습니다.
공유 권한 수정
ACL 항목을 업데이트하려면 필요에 따라 항목을 수정하고 항목의 PUT
요청을 edit
요소(<link>
요소)로 전송합니다. 이 요소는 'rel' 속성이 'edit'으로 설정됩니다. 이전 예시의 링크는 다음과 같습니다.
<link rel='edit' type='application/atom+xml' href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>
아래 스니펫에서는 new_writer@gmail.com
의 역할을 '리더'로 변경합니다.
PUT /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/> <gAcl:role value='reader'/> <gAcl:scope type='user' value='new_writer@gmail.com'/> </entry>
공유 권한 삭제
이 사용자의 권한을 삭제하려면 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 참조 가이드를 참고하세요.
일괄 처리
일괄 요청을 통해 클라이언트는 각 작업을 개별적으로 제출하는 대신 하나의 요청으로 여러 작업을 실행할 수 있습니다.
서버는 요청된 변경사항을 최대한 많이 수행하고 각 작업의 성공 또는 실패를 평가하는 데 사용할 수 있는 상태 정보를 반환합니다. 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>