Create, Update, and Delete a Page
Learn about the blog page and how to create, update, and delete it.
Overview
A blog page, also referred to as a page, contains information that is not going to be updated or changed. This commonly includes profile, business, or contact information. Blog pages are not timestamped.
Page attributes
The table below shows the complete list of properties for the page class.
Parameter | Type | Description |
| string | The type of object. Value: "blogger#page" Note: This value is fixed. |
| string | The ID of the page. |
| object | The object that contains the blog information for the page. |
| string | The Blog ID for the page. |
| datetime | The page's publishing date. Format: yyyy-mm-dd |
| datetime | The date of page's last update. Format: yyyy-mm-dd |
| string | The published link of the page. |
| string | The Blogger API URL of the page. |
| string | The title of the page. |
| string | The content of the page. |
| object | The object that contains the author information of the page. |
| string | The ID of the author. |
| string | The name of the author. |
| string | The published link of the author profile. |
| object | The object that contains the author avatar information. |
| string | The URL of the author avatar. |
| string | The page status for admin resources. Allowable values: "LIVE", "DRAFT" |
Methods
We'll now look at various methods of the page class that'll enable us to create, update, and delete a blog page.
Create a page
We can create a blog page by sending a POST
request to the following URL:
https://blogger.googleapis.com/v3/blogs/{blogId}/pages
As part of the request body, we'll need to provide a page object that contains the attributes given in the table above. Moreover, we'll need to specify the blogId
of the blog that we would like to add the new page to.
Request parameters
Parameter | Type | Category | Description |
| string | required | The ID of the blog to add the page to. |
Sample code
Enter the value for the required parameter blogId
on line 1 in the widget below. Add values for title
and content
attributes as part of the request body on lines 4–5. Try adding the values for other optional parameters listed in the page attributes table above.
Click the "Run" button to see the output.
blogId = ''data = {"title": "","content": ""}url = 'https://blogger.googleapis.com/v3/blogs/' \+ blogId + '/pages'response = requests.post(url, headers=headers, json=data)printResponse(response)
The above code displays the newly created page object containing the attributes listed in the page properties table above. An appropriate error message will be displayed if the API call fails.
Update a page
In order to update a blog page, we can make a PUT
request to the following URL, providing the blogId
of the blog that contains the page to be updated in addition to the pageId
of the page that we would like to update:
https://blogger.googleapis.com/v3/blogs/{blogId}/pages/{pageId}
Furthermore, as part of the request body, we can update any of the fields given in the page attributes table above.
Request parameters
Parameter | Type | Category | Description |
| string | required | The ID of the blog whose page is to be updated. |
| string | required | The ID of the page to be updated. |
Sample code
In the code below, let's change the title
of an existing page. Enter the values for the required parameters blogId
and pageId
on lines 1–2. Add the new value for the title
attribute on line 5. Try updating any other attribute(s) listed in the page attributes table above.
Click the "Run" button to see the output.
blogId = ''pageId = ''data = {'title': '',}url = 'https://blogger.googleapis.com/v3/blogs/' \+ blogId + '/pages/' + pageIdresponse = requests.put(url, headers=headers, json=data)printResponse(response)
The above code displays the complete page object corresponding to the given pageId
. This page object contains the attributes listed in the page properties table above with updated values. An appropriate error message will be displayed if the API call fails.
Delete a page
We can delete a blog page by making a DELETE
request to the following URL:
https://blogger.googleapis.com/v3/blogs/{blogId}/pages/{pageId}
This endpoint requires the blogId
of the blog from which we're deleting the page in addition to the pageId
corresponding to the page that we would like to delete.
Request parameters
Parameter | Type | Category | Description |
| string | required | The ID of the blog whose page is to be deleted. |
| string | required | The ID of the page to be deleted. |
Sample code
In the code below, enter the values for the required parameters blogId
and pageId
on lines 1–2.
Click the "Run" button to see the output.
blogId = ''pageId = ''url = 'https://blogger.googleapis.com/v3/blogs/' \+ blogId + '/pages/' + pageIdresponse = requests.delete(url, headers=headers)printResponse(response)
The above code displays a success message if the page object corresponding to the given pageId
is successfully deleted. An appropriate error message will be displayed if the API call fails.