Posts: list

  • This method retrieves a list of posts from a blog.

  • Authorization is required for private blogs but not for public ones.

  • The HTTP request is a GET request to the specified endpoint, requiring a blogId.

  • Various optional parameters are available to filter and sort the retrieved posts.

  • The response includes a list of posts and a pagination token if applicable.

Retrieves a list of posts. Try it now or see an example.

Authorization 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.

Request

HTTP request

GET https://www.googleapis.com/blogger/v3/blogs/blogId/posts

Parameters

Parameter name Value Description
Required parameters
blogId string The ID of the blog to fetch posts from.
Optional parameters
endDate datetime Latest post date to fetch, a date-time with RFC 3339 formatting.
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)
fetchImages boolean Whether image URL metadata for each post is included.
labels string Comma-separated list of labels to search for.
maxResults unsigned integer Maximum number of posts to fetch.
orderBy string Sort order applied to results.

Acceptable values are:
  • "published": Order by the date the post was published
  • "updated": Order by the date the post was last updated
sortOption string UNAVAILABLE NOW

Sort direction applied to results.

Acceptable values are:
  • "descending": Sort posts in descending order in time (default)
  • "ascending": Sort posts in ascending order in time
pageToken string Continuation token if the request is paged.
startDate datetime Earliest post date to fetch, a date-time with RFC 3339 formatting.
status string

Acceptable values are:
  • "draft": Draft posts
  • "live": Published posts
  • "scheduled": Posts that are scheduled to publish in future.
view string

Acceptable values are:
  • "ADMIN": Admin level detail
  • "AUTHOR": Author level detail
  • "READER": Reader level detail

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "blogger#postList",
  "nextPageToken": string,
  &quo}t;items": [
    posts Resource
  ]
Property name Value Description Notes
kind string The kind of this entity. Always blogger#postList.
nextPageToken string Pagination token to fetch the next page, if one exists.
items[] list The list of posts for this blog.

Examples

Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).

Java

Uses the Java client library

// The BlogId for the Blogger Buzz blog String BUZZ_BLOG_ID = "23999
53"
; // Configure the Java API Client for Installed
Native AppHttpTransport HTTP_TRANSPORT = new NetHttpTr
ansport();JsonFactory JSON_FACTORY = new Jackson
Factory();
// Configure the Installed App OA
uth2 flow.Credential credential = OAuth2Native.authorize(HTTP_
TRANSPORT, JSON_FACTORY, new LocalServerR
eceiver(), Arrays.asList(BloggerScopes.
BLOGGER));
// Construct the Blogger API access faca
de object.Blogger blogger = Blogger.builder(HTTP_TRANSPORT, JSO
N_FACTORY) .setApplicationName("Blogger-PostsLis
t-Snippet/1.0") .setHttpRequestInitializer(
credential).build();
//
The request action.List postsListAction = blogger.posts()
.list(BUZZ_BLOG_ID);
// Restrict the result content to ju
st the data we need.postsListAction.setFields("items(author/displayName,content,published,ti
tle,url),nextPageToken");
// This step se
nds the request to the server.PostList post
s = postsListAction.execute();
// Now
we can navigate t
he response.int po
stCount = 0;int pageCount = 0;wh&&ile (posts.getItems() != null {
!posts.getItems().isEmpty()) for ({
Post post : posts.getItems()) System.out.p
rintln("Post #"+ ++postCount); System.o
ut.println("\tTitle: "+post.getTitle()); System.out.printl
n("\tAuthor: "+post.getAuthor().getDisplayName()
); System.out.println("\tPublished: &quo
t;+post.getPublished()); System.out.println("\tU
R}
L: "+post.getUrl
()); System.out.println("\tContent: &qu
ot;+post.getContent());
// Paginatio>n log{
ic Strin
g}
pageToken = posts.getNextPageToken(); if (pa
geToken == null || ++pageCount = 5) bre
ak; System.out.println("-- Ne
}xt page of posts"); postsListAction.setPageToken(pageToken); posts = postsListAction.execute();

Try it!

Use the APIs Explorer below to call this method on live data and see the response.