게시물: 목록
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
게시물 목록을 검색합니다.
지금 사용해 보거나 예를 참조하세요.
게시물이 비공개 블로그에 있는 경우 승인이 필요합니다. 게시물이 공개 블로그에 있는 경우 승인 없이 이 메서드를 호출할 수 있습니다.
요청
HTTP 요청
GET https://www.googleapis.com/blogger/v3/blogs/blogId/posts
매개변수
매개변수 이름 |
값 |
설명 |
필수 매개변수 |
blogId |
string |
게시물을 가져올 블로그의 ID입니다.
|
선택적 매개변수 |
endDate |
datetime |
가져올 최근 게시 날짜로, RFC 3339 형식의 date-time 입니다.
|
fetchBodies |
boolean |
게시물의 본문 콘텐츠를 포함할지 여부입니다 (기본값: true). 트래픽을 최소화하려면 게시물 본문이 필요하지 않은 경우 false로 설정해야 합니다.
(기본값: true )
|
fetchImages |
boolean |
각 게시물의 이미지 URL 메타데이터 포함 여부입니다.
|
labels |
string |
검색할 라벨 목록(쉼표로 구분)입니다.
|
maxResults |
unsigned integer |
가져올 최대 게시물 수입니다.
|
orderBy |
string |
정렬 순서가 결과에 적용되었습니다.
사용 가능한 값은 다음과 같습니다.
<ph type="x-smartling-placeholder"></ph>
- '
published ': 게시물이 게시된 날짜순으로 정렬합니다.
- '
updated ': 게시물이 최종 업데이트된 날짜순으로 정렬합니다.
|
sortOption |
string |
UNAVAILABLE NOW
정렬 방향이 결과에 적용되었습니다.
사용 가능한 값은 다음과 같습니다.
<ph type="x-smartling-placeholder"></ph>
- "
descending ": 게시물을 시간의 내림차순으로 정렬합니다 (기본값).
- "
ascending ": 게시물을 시간의 오름차순으로 정렬
|
pageToken |
string |
요청이 페이징된 경우의 연속 토큰입니다.
|
startDate |
datetime |
가져올 가장 빠른 게시 날짜로, RFC 3339 형식의 date-time 입니다.
|
status |
string |
사용 가능한 값은 다음과 같습니다.
<ph type="x-smartling-placeholder"></ph>
- "
draft ": 임시 게시물
- "
live ": 게시된 게시물
- '
scheduled ': 향후 게시가 예약된 게시물입니다.
|
view |
string |
사용 가능한 값은 다음과 같습니다.
<ph type="x-smartling-placeholder"></ph>
- "
ADMIN ": 관리자 수준 세부정보
- '
AUTHOR ': 작성자 수준 세부정보
- "
READER ": 독자 수준 세부정보
|
요청 본문
이 메소드를 사용할 때는 요청 본문을 제공하지 마세요.
응답
요청에 성공할 경우 이 메소드는 다음과 같은 구조의 응답 본문을 반환합니다.
{
"kind": "blogger#postList",
"nextPageToken": string,
"items": [
posts Resource
]
}
속성 이름 |
값 |
설명 |
참고 |
kind |
string |
이 항목의 종류입니다. 항상 blogger#postList 입니다. |
|
nextPageToken |
string |
다음 페이지를 가져오는 페이지로 나누기 토큰입니다(있는 경우). |
|
items[] |
list |
이 블로그의 게시물 목록입니다. |
|
예
참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.
자바
Java 클라이언트 라이브러리 사용
// The BlogId for the Blogger Buzz blog
String BUZZ_BLOG_ID = "2399953";
// Configure the Java API Client for Installed Native App
HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
// Configure the Installed App OAuth2 flow.
Credential credential = OAuth2Native.authorize(HTTP_TRANSPORT,
JSON_FACTORY, new LocalServerReceiver(),
Arrays.asList(BloggerScopes.BLOGGER));
// Construct the Blogger API access facade object.
Blogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)
.setApplicationName("Blogger-PostsList-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// The request action.
List postsListAction = blogger.posts().list(BUZZ_BLOG_ID);
// Restrict the result content to just the data we need.
postsListAction.setFields("items(author/displayName,content,published,title,url),nextPageToken");
// This step sends the request to the server.
PostList posts = postsListAction.execute();
// Now we can navigate the response.
int postCount = 0;
int pageCount = 0;
while (posts.getItems() != null && !posts.getItems().isEmpty()) {
for (Post post : posts.getItems()) {
System.out.println("Post #"+ ++postCount);
System.out.println("\tTitle: "+post.getTitle());
System.out.println("\tAuthor: "+post.getAuthor().getDisplayName());
System.out.println("\tPublished: "+post.getPublished());
System.out.println("\tURL: "+post.getUrl());
System.out.println("\tContent: "+post.getContent());
}
// Pagination logic
String pageToken = posts.getNextPageToken();
if (pageToken == null || ++pageCount >= 5) {
break;
}
System.out.println("-- Next page of posts");
postsListAction.setPageToken(pageToken);
posts = postsListAction.execute();
}
사용해 보기
아래의 API 탐색기를 사용하여 실시간 데이터를 대상으로 이 메소드를 호출하고 응답을 확인해 보세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-08-21(UTC)
[null,null,["최종 업데이트: 2024-08-21(UTC)"],[[["\u003cp\u003eRetrieves a list of posts from a specified blog, requiring authorization for private blogs but not for public ones.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering of posts by date, labels, status, and other criteria using optional parameters.\u003c/p\u003e\n"],["\u003cp\u003eSupports pagination to retrieve large lists of posts in manageable chunks.\u003c/p\u003e\n"],["\u003cp\u003eProvides options to control the inclusion of post bodies and image metadata for traffic optimization.\u003c/p\u003e\n"],["\u003cp\u003eReturns a response containing post details like title, author, publication date, content, and URL.\u003c/p\u003e\n"]]],[],null,["# Posts: list\n\nRetrieves a list of posts.\n[Try it now](#try-it) or [see an example](#examples).\n\n[Authorization](/blogger/docs/3.0/using#auth) is required if the posts are on a blog that is private. If the posts are on a blog that is public, then this method can be called without authorization.\n\nRequest\n-------\n\n### HTTP request\n\n```\nGET https://www.googleapis.com/blogger/v3/blogs/blogId/posts\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Required parameters** |||\n| `blogId` | `string` | The ID of the blog to fetch posts from. |\n| **Optional parameters** |||\n| `endDate` | `datetime` | Latest post date to fetch, a `date-time` with [RFC 3339](http://www.ietf.org/rfc/rfc3339.txt\"\") formatting. |\n| `fetchBodies` | `boolean` | Whether the body content of posts is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic. (Default: `true`) |\n| `fetchImages` | `boolean` | Whether image URL metadata for each post is included. |\n| `labels` | `string` | Comma-separated list of labels to search for. |\n| `maxResults` | `unsigned integer` | Maximum number of posts to fetch. |\n| `orderBy` | `string` | Sort order applied to results. \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`published`\": Order by the date the post was published - \"`updated`\": Order by the date the post was last updated |\n| `sortOption` | `string` | `UNAVAILABLE NOW` \u003cbr /\u003e \u003cbr /\u003e Sort direction applied to results. \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`descending`\": Sort posts in descending order in time (default) - \"`ascending`\": Sort posts in ascending order in time |\n| `pageToken` | `string` | Continuation token if the request is paged. |\n| `startDate` | `datetime` | Earliest post date to fetch, a `date-time` with [RFC 3339](http://www.ietf.org/rfc/rfc3339.txt) formatting. |\n| `status` | `string` | Acceptable values are: - \"`draft`\": Draft posts - \"`live`\": Published posts - \"`scheduled`\": Posts that are scheduled to publish in future. |\n| `view` | `string` | Acceptable values are: - \"`ADMIN`\": Admin level detail - \"`AUTHOR`\": Author level detail - \"`READER`\": Reader level detail |\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```objective-c\n{\n \"kind\": \"blogger#postList\",\n \"nextPageToken\": string,\n \"items\": [\n posts Resource\n ]\n}\n```\n\n| Property name | Value | Description | Notes |\n|-----------------|----------|---------------------------------------------------------|-------|\n| `kind` | `string` | The kind of this entity. Always `blogger#postList`. | |\n| `nextPageToken` | `string` | Pagination token to fetch the next page, if one exists. | |\n| `items[]` | `list` | The list of posts for this blog. | |\n\nExamples\n--------\n\n**Note:** The code examples available for this method do not represent all supported programming languages (see the [client libraries page](/blogger/docs/3.0/libraries) for a list of supported languages). \n\n### Java\n\nUses the [Java client library](http://code.google.com/p/google-api-java-client/) \n\n```java\n// The BlogId for the Blogger Buzz blog\nString BUZZ_BLOG_ID = \"2399953\";\n\n// Configure the Java API Client for Installed Native App\nHttpTransport HTTP_TRANSPORT = new NetHttpTransport();\nJsonFactory JSON_FACTORY = new JacksonFactory();\n\n// Configure the Installed App OAuth2 flow.\nCredential credential = OAuth2Native.authorize(HTTP_TRANSPORT,\n\tJSON_FACTORY, new LocalServerReceiver(),\n\tArrays.asList(BloggerScopes.BLOGGER));\n\n// Construct the Blogger API access facade object.\nBlogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)\n\t.setApplicationName(\"Blogger-PostsList-Snippet/1.0\")\n\t.setHttpRequestInitializer(credential).build();\n\n// The request action.\nList postsListAction = blogger.posts().list(BUZZ_BLOG_ID);\n\n// Restrict the result content to just the data we need.\npostsListAction.setFields(\"items(author/displayName,content,published,title,url),nextPageToken\");\n\n// This step sends the request to the server.\nPostList posts = postsListAction.execute();\n\n// Now we can navigate the response.\nint postCount = 0;\nint pageCount = 0;\nwhile (posts.getItems() != null && !posts.getItems().isEmpty()) {\n\tfor (Post post : posts.getItems()) {\n\t\tSystem.out.println(\"Post #\"+ ++postCount);\n\t\tSystem.out.println(\"\\tTitle: \"+post.getTitle());\n\t\tSystem.out.println(\"\\tAuthor: \"+post.getAuthor().getDisplayName());\n\t\tSystem.out.println(\"\\tPublished: \"+post.getPublished());\n\t\tSystem.out.println(\"\\tURL: \"+post.getUrl());\n\t\tSystem.out.println(\"\\tContent: \"+post.getContent());\n\t}\n\n\t// Pagination logic\n\tString pageToken = posts.getNextPageToken();\n\tif (pageToken == null || ++pageCount \u003e= 5) {\n\t\tbreak;\n\t}\n\tSystem.out.println(\"-- Next page of posts\");\n\tpostsListAction.setPageToken(pageToken);\n\tposts = postsListAction.execute();\n}\n```\n\nTry it!\n-------\n\n\nUse the APIs Explorer below to call this method on live data and see the response."]]