List and Search Posts

Learn about various endpoints to list and search posts in a blog.

In this lesson, we'll look at various endpoints enabling us to retrieve a single blog post and a list of all blog posts. We'll also learn how to search for a post based on some search text.

Methods

List all posts

We can retrieve a list of all blog posts by making a GET request to the following URL:

Press + to interact
https://blogger.googleapis.com/v3/blogs/{blogId}/posts

We'll need to specify the blogId of the blog whose posts we want to retrieve.

Request Parameters

Parameter

Type

Category

Description

blogId

string

required

The ID of the blog whose posts are to be retrieved.

endDate

datetime

optional

The date till which the posts are to be retrieved.

Format: yyyy-mm-ddThh:mm:ss.ssZ

fetchBodies

boolean

optional

The option to decide whether to include the posts' body content. 

Allowable values: true to include the posts’ body content, false otherwise

Default value: true

fetchImages

boolean

optional

The option to decide whether to include the image URL metadata.

Allowable values: true to include the image URL metadata, false otherwise

labels

string

optional

A comma-delimited list of labels we want to search.

maxResults

integer

optional

The number of posts to retrieve.

orderBy

string

optional

The sort order for the results.

Allowable values: published to order by publishing date, updated to order by the date of the last update

pageToken

string

optional

The next page's pagination token.

Note: This parameter will only be displayed if it exists.

startDate

datetime

optional

The date from which the posts are to be retrieved.

Format: yyyy-mm-ddThh:mm:ss.ssZ

status

string

optional

The status of the posts to retrieve.

Allowable values: draft, live, scheduled

view

string

optional

The level of details to be retrieved.

Allowable values: ADMIN, AUTHOR, READER

In the code below, we've used the stored value of BLOG_ID on line 8. Try adding the values for optional parameters to the ...