...

/

List and Search Posts

List and Search Posts

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

Overview

In this lesson, we'll look at various endpoints that'll enable 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:

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

"True" to include posts' body content, "False" otherwise.

Default value: "True"

fetchImages

boolean

optional

"True" to include 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 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 when 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"

Sample code

In the code below, enter the value for the required parameter blogId on line 1 ...