Saturday 3 February 2024

Use C# To Access Blog (Blogger.com)

Overview

Blogger.com offers a fairly easy way to upload and manipulate content. However, I think it falls short in certain aspects.

  • View existing post titles and links.
    Useful for adding links to other posts when creating a new post.
  • Offline synchronization
    It would be useful to store all posts on a local drive. Each post would be stored within its own directory. This allows additional information to be associated with a post, e.g. coding projects.

In this post I will show how to use the Google API to obtain blog/post information.

In this post

Requirements

The following requirements were obtained by understanding what the API is capable of. The following links give details.

The primary requirements are to access blog post information from Blogger.com using is API (Application Programming Interface).

This can be broken down into subtasks.

  • Get blog summary
    This will include title, description, date published, date last updated, the primary URL, total page and post counts.
  • Get a summary of posts
    Each post summary should contain, as a minimum, the title, url, date published, date last updated.
  • Get post
    Get post should return the HTML content and post summary.
Top

Blogger.com API Basics

The API expects a URL to query blog/post information. The URL must include an API key.

A typical request URL is https://www.googleapis.com/blogger/v3/blogs/{BlogId}?key={Your API key}

BlogId can be found by logging in to Blogger.com and selecting posts (the default when signing in). You should see something like...
https://www.blogger.com/blog/posts/1967019************
The number following /posts/ is the blog id.

To use the Blogger.com API you will need an API key. This is standard practice for online services. An existing blog site is required for this stage. Visit Creating an API key.

The Blogger.com API returns Json assuming a request was successful.

Top