Overview

A blog represents the base entity of the Blogger API. It's a website where the content is shared with a target audience. A blog consists of pages and posts that contain the information to be shared.

Blog properties

The table below shows the list of properties that comprise the blog class.

Parameter

Type

Description

kind

string

The type of object.

Value: "blogger#blog"

Note: This value is fixed.

id

string

The ID of the blog.

name

string

The name/title of the blog.

Note: This value can include HTML.

description

string

The description of the blog.

Note: This value can include HTML.

published

datetime

The blog's date of publishing.

Format: yyyy-mm-dd

updated

datetime

The date of the blog's last update.

Format: yyyy-mm-dd

url

string

The published link of the blog.

selfLink

string

The Blogger API URL of the blog.

posts

object

The object that contains blog posts.

posts.totalItems

integer

The number of blog posts.

posts.selfLink

string

The Blogger API URL of the blog posts collection.

pages

object

The object that contains blog pages.

pages.totalItems

integer

The number of blog pages.

pages.selfLink

string

The Blogger API URL of the blog pages collection.

locale

object

The object containing locale information of the blog.

locale.language

string

The language of the blog.

locale.country

string

The country corresponding to the language.

locale.variant

string

The language variant of the blog.

customMetaData

string

The metadata of the blog.

posts.items[]

list

The list of blog posts.

Methods

Now, let's take a look at some of the methods that we can invoke for the blog class.

Get blogs by user ID

We can retrieve a list of all the blogs of a specific user by making a GET request to the following endpoint:

https://blogger.googleapis.com/v3/users/{userId}/blogs

This endpoint requires the ID of the user whose blogs we would like to retrieve.

Request parameters

Parameter

Type

Category

Description

userId

string

required

The ID of the user whose blogs are to be retrieved.

Allowable values: "self" or a user ID

fetchUserInfo

boolean

optional

"True" to retrieve user information along with user's blogs, "False" otherwise.

view

string

optional

The level of details to be retrieved.

Allowable values: "ADMIN", "AUTHOR", "READER"

Sample code

In the code below, we've used the already stored value of USER_ID. Try adding the optional parameters, fetchUserInfo and view, to the URL on line 1 to fine-tune the results.

Click the "Run" button to see the output.

Press + to interact
url = 'https://blogger.googleapis.com/v3/users/{{USER_ID}}/blogs'
response = requests.get(url, headers=headers)
printResponse(response)

The above code displays the complete list of blogs associated with the user specified by the USER_ID. The output contains one of the response parameters given in the table below. An appropriate error message will be displayed if the API call fails.

Response parameters

Parameter

Type

Description

kind

string

The type of object.

Value: "blogger#blogList"

Note: This value is fixed.

items[]

list

The list of blogs for which the user has admin or authorship rights.

blogUserInfos[]

list

The admin-level list of blog-user information.

Get a blog by its ID

We can retrieve a blog using its ID by making a GET request to the following endpoint:

https://blogger.googleapis.com/v3/blogs/{blogId}

This endpoint requires the blogId of the blog that we would like to retrieve.

Request parameters

Parameter

Type

Category

Description

blogId

string

required

The ID of the blog to retrieve.

maxPosts

integer

optional

The number of posts to retrieve.

Note: No posts will be retrieved if this value is not specified.

Sample code

Enter the value for the required parameter blogId on line 1 in the widget below. You can get the blogId from the output of the above code. Try adding the optional parameter, maxPosts, to the URL on lines 3–4 to specify the number of blog posts to retrieve.

Click the "Run" button to see the output.

Press + to interact
blogId = ''
url = 'https://blogger.googleapis.com/v3/blogs/' \
+ blogId
response = requests.get(url, headers=headers)
printResponse(response)

The above code displays the complete blog object corresponding to the given blogId. This blog object consists of the attributes listed in the blog properties table above. An appropriate error message will be displayed if the API call fails.

Get a blog by its URL

We can retrieve a blog using its URL by making a GET request to the following endpoint:

https://blogger.googleapis.com/v3/blogs/byurl?url={blogUrl}

This endpoint requires the blogUrl of the blog that we would like to retrieve.

Request parameters

Parameter

Type

Category

Description

blogUrl

string

required

The URL of the blog to retrieve.

Sample code

Enter the value for the required parameter blogUrl on line 1 in the widget below. You can get the blogUrl from the output of the first code.

Click the "Run" button to see the output.

Press + to interact
blogUrl = ''
url = 'https://blogger.googleapis.com/v3/blogs/byurl?url=' \
+ blogUrl
response = requests.get(url, headers=headers)
printResponse(response)

The above code displays the complete blog object published at the given blogUrl. This blog object contains of the attributes listed in the blog properties table above. An appropriate error message will be displayed if the API call fails.