For weeks, I've been using the Google API to retrieve JSON data from my Blogger account and showcase and style blog posts on my personal website.
Everything was functioning flawlessly until yesterday when, out of the blue, the content
section stopped displaying. The title
, update
(the post's update date), and the id
are all being returned as usual. It's just the content
that is no longer appearing.
I haven't made any changes to the code since I first implemented it, and after checking documentation for any API modifications, I came up empty-handed. So, I'm completely perplexed as to why this particular part of the code would suddenly cease to function.
This snippet of Javascript below represents most of what I use to obtain the JSON data. Do you see anything incorrect with it?
function init() {
// Fetch your API key from http://code.google.com/apis/console
gapi.client.setApiKey('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
// Load the Blogger JSON API
gapi.client.load('blogger', 'v3', function() {
// Retrieve the list of posts for code.blogger.com
var request = gapi.client.blogger.posts.list({
'blogId': 'xxxxxxxxxxxxxxxxxxx',
'fields': 'items(content,title,updated,id)'
});
request.execute(function(response) {
var blogger = document.getElementById("blogger");
var anchor = 0;
for (var i = 0; i < response.items.length; i++)
{
var bloggerDiv = document.createElement("div");
bloggerDiv.id = "blogger-" + i;
bloggerDiv.className = "bloggerItem";
$(bloggerDiv).append("<h2>" + response.items[i].title + "</h2>");
var date = response.items[i].updated;
date = date.replace("T", " ");
date = date.replace("+09:00", "");
var printDate = new moment(date);
$(bloggerDiv).append("<p><span class='byline'>" + printDate.format('dddd, MMMM Do YYYY, h:mm:ss a') + "</span></p>");
$(bloggerDiv).append(response.items[i].content)
bloggerAnchor = document.createElement("a");
bloggerAnchor.name = "blogger-" + response.items[i].id;
blogger.appendChild(bloggerAnchor);
blogger.appendChild(bloggerDiv);
anchor = anchor + 1;
}
// Determine which anchor the user selected...
var hashVal = window.location.hash.substr(1);
// ...then scroll to that position:
location.hash = "#" + hashVal;
});
});
}