Blogs
Learn about blogs and the various endpoints to list and search for them.
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 |
| string | The type of object. Value: "blogger#blog" Note: This value is fixed. |
| string | The ID of the blog. |
| string | The name/title of the blog. Note: This value can include HTML. |
| string | The description of the blog. Note: This value can include HTML. |
| datetime | The blog's date of publishing. Format: yyyy-mm-dd |
| datetime | The date of the blog's last update. Format: yyyy-mm-dd |
| string | The published link of the blog. |
| string | The Blogger API URL of the blog. |
| object | The object that contains blog posts. |
| integer | The number of blog posts. |
| string | The Blogger API URL of the blog posts collection. |
| object | The object that contains blog pages. |
| integer | The number of blog pages. |
| string | The Blogger API URL of the blog pages collection. |
| object | The object containing locale information of the blog. |
| string | The language of the blog. |
| string | The country corresponding to the language. |
| string | The language variant of the blog. |
| string | The metadata of the blog. |
| 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 |
| string | required | The ID of the user whose blogs are to be retrieved. Allowable values: "self" or a user ID |
| boolean | optional | "True" to retrieve user information along with user's blogs, "False" otherwise. |
| 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.
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 |
| string | The type of object. Value: "blogger#blogList" Note: This value is fixed. |
| list | The list of blogs for which the user has admin or authorship rights. |
| 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 |
| string | required | The ID of the blog to retrieve. |
| 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.
blogId = ''url = 'https://blogger.googleapis.com/v3/blogs/' \+ blogIdresponse = 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 |
| 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.
blogUrl = ''url = 'https://blogger.googleapis.com/v3/blogs/byurl?url=' \+ blogUrlresponse = 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.
Users
Create, Update, and Delete a Page