This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Blogger API v3 Connector
The Blogger API v3 connector allows you to connect to Google Blogger, a free weblog publishing tool from Google, for sharing text, photos and video. The connector uses the Blogger API v3 to connect to Google Blogger to retrieve information and manipulate Blogs, Posts and Comments. It uses the RESTfull API calling style to invoke the methods exposed by the Blogger API.
The following sections describe how to perform various operations with the connector. For general information on using connectors and their operations in your ESB configurations, see Using a Connector.
Additional information
For general information on using connectors and their operations in your ESB configurations, see Using a Connector. To download the connector, go to https://store.wso2.com/store/assets/esbconnector/details/blogger, and click Download Connector. Then you can add and enable the connector in your ESB instance.
Connecting to Blogger
To use the Blogger API connector, add the <blogger.init>
element in your configuration before any other Blogger method invocation. This methods initialises the connector and takes two parameters,
<apiKey> parameter, which is a mandatory parameter that accepts the API key provided by Google Blogger , that can be obtained from the Google API console.
<accessToken> parameter, an optional parameter needed when calling operations in Blogger API needing authentication and when invoking any method for private blog.Blogger API uses Oauth 2.0 as authentication method this parameter is the access token that can be obtained from the Google Oauth Playground
<blogger.init> <apiKey>AIzaSyC-fVD7wQtYqwN4owNxLINjHBQGDZ</apiKey> <accessToken>ya29.1.AADtN_XyJg7h9DI0LJLpR53F7iaClmfcixih9JdRSZ4_upgeINUy05aRXWhMUzAHS</accessToken> </blogger.init>
For all method in the following sections, only the <apiKey> would be required, unless stated otherwise.
Entering secure data
For security purposes, you should store your accessToken and API key in the WSO2 secure vault and reference it by alias instead of hard-coding the actual values in the configuration file. For more information, see Working with Passwords.
Working with Blogs
The following operations are available for working with Blog Resources:
Operation | Description |
---|---|
getBlog | Return information of specific blog identified by its blog id, as blog resource. |
getByURL | Return information of specific blog identified by its URL, as blog resource. |
listByUser | Return a list of blogs by a user specified by a user id. |
Following is more information about these operations.
Get blog information by ID
<blogger.getBlog> <blogID>19072347933726</blogID> </blogger.getBlog>
Oauth authentication is needed if the Blog is a Private blog. Therefore the <a when performing this operation on private blog ccessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog to get.
optionalmaxPosts:
Maximum number of posts to retrieve along with the blog. When this tag is not specified, no posts will be returned as part of the blog resource.fields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a blog resource matching the blog ID provided.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/blogs/get
Get blog information by URL
<blogger.getByURL> <url>http://example.blogspot.com</url> </blogger.getByURL>
Oauth authentication is needed if the Blog is a Private blog. Therefore when performing this operation on private blog the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog to get.
optionalfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a blog resource matching the url provided.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/blogs/getByUrl
List Blogs by User
<blogger.listByUser> <userID>453344533<userID> </blogger.listByUser>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
userID
: The ID of the user whose blogs are to be fetched. Either the wordself
or the user's profile ID.
optionalfetchUserInfo
: Whether the response is a list of blogs with per-user information instead of just blogs. Accept 'true' or 'false'.view
: Level of details. Acceptable values are:
"ADMIN
": Admin level detail
"AUTHOR
": Author level detail
"READER
": Admin level detailfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a list of blog resources by the user with user ID.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/blogs/listByUser
Working with Posts
The following operations are available for working with Post Resources:
Operation | Description |
---|---|
listPosts | Returns a List of posts of a specific blog |
getPost | Return a specific post of a specific blog |
searchPost | Search for a post matching a specific keyword |
insertPost | Insert a new post to a specific blog |
deletePost | Delete a specific post in a specific blog |
getPostByPath | Return a specific post of a specific blog, by posts path |
patchPost | Apply a patch to an existing post in a specific blog |
updatePost | Update a specific post of a specific blog |
publishPost | Publish a specific draft state post of specific blog |
revertPost | Revert a specific post of a specific blog to its draft state |
Following is more information about these operations.
List Posts In Blog
<blogger.listPosts> <blogID>19072347933726</blogID> </blogger.listPosts>
Oauth authentication is needed if the Blog is a Private blog. Therefore when performing this operation on private blog the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog to get.
optional- endDate : Latest post date to fetch, a date-time with format .
- fetchBodies: A boolean value of 'true' or 'false'. Whether the body content of posts is included.
- fetchImages: A boolean value of 'true' or 'false'. Whether image URL metadata for each post is included.
- labels: Comma-separated list of labels to search for.
- maxResults: A number representing the maximum number of posts to fetch.
- orderBy: Sort order applied to results. Acceptable values are:
"published": Order by the date the post was published
"updated": Order by the date the post was last updated
pageToken: Continuation token if the request is paged.
startDate: Earliest post date to fetch, a date-time with format YYYY-MM-DD
status: Acceptable values are:
"draft": Draft posts
"live": Published posts
"scheduled": Posts that are scheduled to publish in future.
view: Acceptable values are:
"ADMIN": Admin level detail
"AUTHOR": Author level detail
"READER": Reader level detail
fields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a list of post resources.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/list
Get a specific Post of Blog
<blogger.searchPost> <blogID>453344533<postID> <postID>1234233444</postID> </blogger.searchPost>
Oauth authentication is needed if the Blog is a Private blog. Therefore when performing this operation on private blog the <accessToken> parameter should be set at initialization of connector.
Properties
blogID: The ID of the blog to return the post from.
postID: The ID of the post.
optionalmaxComments
: A number representing the maximum number of comments to return with the post. If not specified, defaults to 0view
: Level of details. Acceptable values are:
"ADMIN
": Admin level detail
"AUTHOR
": Author level detail
"READER
": Admin level detailfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource matching post ID provided.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/get
Search a Post with a specific keyword
<blogger.searchPost> <blogID>453344533<blogID> <query>NUMERIC</query> </blogger.searchPost>
Oauth authentication is needed if the Blog is a Private blog. Therefore when performing this operation on private blog the <accessToken> parameter should be set at initialization of connector.
Properties
blogID: The ID of the blog in which the search is performed
query: Keyword to query in post.
optional- fetchBodies: A boolean value of 'true' or 'false'. Whether the body content of posts is included.
- orderBy: Sort order applied to results. Acceptable values are:
"published": Order by the date the post was published
"updated": Order by the date the post was last updated fields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource matching the query term.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/search
Add a new Post to a specific Blog
<blogger.insertPost> <blogID>453344533<blogID> <isDraft>false</isDraft> <title>New Post</title> <content>This is a new post</content> </blogger.insertPost>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
optionalblogID
: The ID of the blog to which the post is posted.isDraft
: Boolean value accepting 'true' or 'false'. Specify whether new post is in draft state or published statetitle
: Title of the postcontent
: The content text of the postauthorName
: Name of author displayedauthorURL
: The URL of the post creator's profile pageauthorImgURL
: The post creator's avatar URLlocationName
: Location namelocationLat
: Location's latitude. Entered as double valuelocationLng
: Location's longitude. Entered as double valuelocationSpan
: Location's viewport span. Used when rendering a map preview.titleLink
: The title link URLlabels
: Comma separated list of labels this post was tagged withimages
: Comma separated list of URLs of display images for the Postpublished
: Date and Time of post publish is scheduled in datetime formatupdate
: Date and Time of post update is scheduled in datetime formatfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource representing the post that was newly created.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/insert
Delete a specific Post
<blogger.deletePost> <blogID>453344533<blogID> <postID>21333444231</postID> </blogger.deletePost>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
blogID: The ID of the blog in which the post is in
postID: The post ID of the post to be deleted
Return Object
No Object returned.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/delete
Get a Post by its path
<blogger.getPostByPath> <blogID>453344533<blogID> <path>/2011/09/blogger-json-api-now-available.html</path> </blogger.getPostByPath>
Oauth authentication is needed if the Blog is a Private blog. Therefore when performing this operation on private blog the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog to which the post is posted.path
: Path of the Post to retrieve
optional
maxComments
: A number representing the maximum number of comments to return with the post. If not specified, defaults to 0view
: Level of details. Acceptable values are:
"ADMIN
": Admin level detail
"AUTHOR
": Author level detail
"READER
": Admin level detail
fields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource representing the post given by path
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/getByPath
Apply a patch to an existing Post of a specific Blog
<blogger.patchPost> <blogID>453344533<blogID> <postID>12442334589</postID> <title>New Title of Post</title> <content>Added content new post</content> </blogger.patchPost>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog in which the patched post resides.
optionalpostID
: The ID of the patched post.title
: Title of the postcontent
: The content text of the postauthorName
: Name of author displayedauthorURL
: The URL of the post creator's profile pageauthorImgURL
: The post creator's avatar URLlocationName
: Location namelocationLat
: Location's latitude. Entered as double valuelocationLng
: Location's longitude. Entered as double valuelocationSpan
: Location's viewport span. Used when rendering a map preview.titleLink
: The title link URLlabels
: Comma separated list of labels this post was tagged withimages
: Comma separated list of URLs of display images for the Post.published
: Date and Time of post publish is scheduled in datetime formatupdate
: Date and Time of post update is scheduled in datetime formatfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource representing the post that was patched.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/patch
Update an existing Post of a specific Blog
<blogger.updatePost> <blogID>453344533<blogID> <postID>12442334589</postID> <title>Updated Title of Post</title> <content>Updated content new post</content> </blogger.updatePost>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog in which the updated post resides.
optionalpostID
: The ID of the post that should be updated.title
: Title of the postcontent
: The content text of the postauthorName
: Name of author displayedauthorURL
: The URL of the post creator's profile pageauthorImgURL
: The post creator's avatar URLlocationName
: Location namelocationLat
: Location's latitude. Entered as double valuelocationLng
: Location's longitude. Entered as double valuelocationSpan
: Location's viewport span. Used when rendering a map preview.titleLink
: The title link URLlabels
: Comma separated list of labels this post was tagged withimages
: Comma separated list of URLs of display images for the Post.published
: Date and Time of post publish is scheduled in datetime formatupdate
: Date and Time of post update is scheduled in datetime formatfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource representing the post that was published.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/update
Publish an existing Post in draft state
<blogger.publishPost> <blogID>453344533<blogID> <postID>12442334589</postID> </blogger.publishPost>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog in which the updated post resides.
optionalpostID
: The ID of the post that should be updated.publishDate:
Date and Time of post publish is scheduled in datetime formatfields:
List of fields of the blog that should be returned. Refer to Specifying Fields
Return Object
Returns a post resource representing the post that was updated.
Related Blogger API documentation
https://developers.google.com/blogger/docs/3.0/reference/posts/publish
Revert an existing Post to draft state
<blogger.revertPost> <blogID>453344533<blogID> <postID>12442334589</postID> </blogger.revertPost>
Oauth authentication is mandatory. Therefore the <accessToken> parameter should be set at initialization of connector.
Properties
blogID
: The ID of the blog in which the updated post resides.
optionalpostID
: The ID of the post that should be updated.fields:
List of fields