The Blogger API enables you to integrate Blogger content with your application by using the REST APIs. Before you begin, you will need to set up authorization.
Introduction
This document is intended for developers who want to write applications that can interact with the Blogger API. Blogger is a tool for creating websites that allow people to publish their thoughts on an ongoing basis.
If you're unfamiliar with Blogger concepts, you should read Getting Started before starting to code.
Authorizing requests and identifying your application
Every request your application sends to the Blogger APIs needs to identify your application to Google. There are two ways to identify your application: using an OAuth 2.0 token (which also authorizes the request) and/or using the application's API key. Here's how to determine which of those options to use:
If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request. The application may also provide the API key, but it doesn't have to.
If the request doesn't require authorization (such as a request for public data), then the application must provide either the API key or an OAuth 2.0 token, or both—whatever option is most convenient for you.
About authorization protocols
Your application must use OAuth 2.0 to authorize requests. No other authorization protocols are supported. If your application uses Sign In With Google, some aspects of authorization are handled for you.
Authorizing requests with OAuth 2.0
Requests to the Blogger APIs for non-public user data must be authorized by an authenticated user.
This process is facilitated with an OAuth client ID.
The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. The following general process applies to all application types:
When your application needs access to user data, it asks Google for a particular scope of access.
Google displays a consent screen to the user, asking them to authorize your application to request some of their data.
If the user approves, then Google gives your application a short-lived access token.
Your application requests user data, attaching the access token to the request.
If Google determines that your request and the token are valid, it returns the requested data.
Some flows include additional steps, such as using refresh tokens to acquire new access tokens. For detailed information about flows for various types of applications, see Google's OAuth 2.0 documentation.
Here's the OAuth 2.0 scope information for the Blogger APIs:
https://www.googleapis.com/auth/blogger
To request access using OAuth 2.0, your application needs the scope information, as well as information that Google supplies when you register your application (such as the client ID and the client secret).
Tip: The Google APIs client libraries can handle some of the authorization process for you. They are available for a variety of programming languages; check the style="box-sizing: inherit; margin-bottom: 0px; outline: 0px; word-break: break-word;">page with libraries and samples for more details.
Acquiring and using an API key
Requests to the Blogger APIs for public data must be accompanied by an identifier, which can be an API key or an access token.
GET https://www.googleapis.com/blogger/v3/blogs/2399953?key=YOUR-API-KEY
A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the blog data:
You can retrieve a list of posts from a given blog by sending a GET request to the posts collection URI. The URI for a posts collection has the following format:
GET https://www.googleapis.com/blogger/v3/blogs/2399953/posts?key=YOUR-API-KEY
A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the list of posts:
You can retrieve a specific post from a blog by sending a GET request to the posts resource URI. The URI for a posts resource has the following format:
GET https://www.googleapis.com/blogger/v3/blogs/2399953/posts/7706273476706534553?key=YOUR-API-KEY
A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the contents of the post:
GET https://www.googleapis.com/blogger/v3/blogs/3213900/posts/search?q=documentation&key=YOUR-API-KEY
A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the contents of the post:
DELETE https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/6819100329896798058
Authorization: /* OAuth 2.0 token here */
You must be authenticated to delete a post.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code.
Retrieving a post by its path
You can retrieve a post from a blog by sending a GET request to the posts bypath URI with a path parameter. The URI for a posts by path request has the following format:
A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the contents of the post:
You can retrieve a list of comments for a post by sending a GET request to the comments collection URI. The URI for a comments collection has the following format:
GET https://www.googleapis.com/blogger/v3/blogs/2399953/posts/6069922188027612413/comments?key=YOUR-API-KEY
"A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the list of comments:
You can retrieve a specific comment from a post by sending a GET request to the comments resource URI. The URI for a comments resource has the following format:
GET https://www.googleapis.com/blogger/v3/blogs/2399953/posts/6069922188027612413/comments/9200761938824362519?key=YOUR-API-KEY
"A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the comment data:
You can retrieve a list of pages for a blog by sending a GET request to the pages collection URI. The URI for a pages collection has the following format:
GET https://www.googleapis.com/blogger/v3/blogs/4967929378133675647/pages?key=YOUR-API-KEY
"A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the list of pages:
You can retrieve a specific page from a blog by sending a GET request to the pages resource URI. The URI for a pages Resource has the following format:
GET https://www.googleapis.com/blogger/v3/blogs/4967929378133675647/pages/273541696466681878?key=YOUR-API-KEY
"A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Response
If the request succeeds, the server responds with an HTTP 200 OK status code and the page data:
0 Comments