Exploring the new Google+ API features

Today Google has released a bunch of new features for the Google+ API. One feature that particulary striked my eye (just after I have released my new website including this blog) was the possibility to obtain the comments for a specific activity.

Despite the fact that it's currently only a one-way feature (i.e. you can get comments but not write new ones), why not using it as a commenting system for a blog? Sure, it's not very useful right now if the only possibility to add a new comment is to head over to the corresponding Google+ post. But as soon as writing is allowed, this could serve as a great way to outsource the commenting system to Google+, where one can probably reach a much higher range of persons compared to one's personal website.

What follows is a really hacky implementation of the new comments feature. I made a small library for CodeIgniter which is currently only able to get the comments of a single activity (specified by its activityID). There is no error handling whatsoever, so please excuse if the page should display any weird errors.

As you can see, comments which are related to this article are shown below. How did I do that? Well, as one isn't able to post anything to Google+ through the API yet, I had to write a new post for this article manually on Google+. Once done, I got the activityID of this post and put it into this article. The "rendering engine" of my blog then parses the ID and gets the comments related to the post, which are eventually displayed.

As said, currently it's of no real usage as you can't post any new comments directly from within the blog, but it's a good start, right?!

Comments

Please go to Google+ to comment on this post.

Me day-dreaming: now if you could somehow link the +1 of this post on G+ with the +1 on your blog... :-)

Actually, this shouldn't be too hard.... wait a few minutes, I'll try something ;-)

+Rutger van der Eijk: unfortunately it doesn't seem to work as I thought it would. But I'll keep that idea in mind. +Banz ai: thanks! looks promising!

+Martin Matysiak have you maybe found an easy way to get the ActivityID? Or do you also just get it from the sourcecode and hard-code it into your script?

Initially I got the activityID via activities.list() on my userID and stored it inside the blog-article. The URL to the post on Google+ is fetched via activities.get() programmatically and then cached in a database.
But I think you could also fetch the activityID programmatically, simply by parsing your latest activities and looking if a link to the article is mentioned somewhere in the activity.

Ah okay, so basically the same thing I did. :)

Ello.

+Will Norris
What would happen if someone reshared your post? Wouldn't that become the most recent one then?
Ignore that you are of course only checking your own public posts, this will become a problem though when the post wanders off behind the 250 post limit.
Using the new search function in the API could also work, maybe, but then you will have to check for author to be sure it's your post.

Didn't +Paul Kinlan have something similar using the Buzz API? Been a while so it might have been someone else as well...

+Gerwin Sturm yes I did it for buzz. It doesn't look too hard to do for plus now either

By Jalaj Jha Posted at 13:40 (05.10.2011) UTC+2

cool... am trying with this comment

edit: Didn't expect that fast..... probably edit to a comment will not show up..

edit again: So is it that everytime a visitor loads the page the comments are read using Google+ API? anyways... good implementation... Once writes are allowed on Google+ side, more possibilities will open up

By Jalaj Jha Posted at 14:07 (05.10.2011) UTC+2

+Martin Matysiak am bit confused with activity-id (just started with API) what's the id for this post? JqbwHdEt6Hg?

+Jalaj Jha one way to get the API activity ID is to look at the source code of the post page, and search for a <div id="update-z...
The long number starting with z is your activityID.
Unfortunately I know of no way to map a post url to an activityID

Or as +Martin Matysiak said (edit: will say ;) ) you can fetch your ActivityList and get the ID from there.

+Jalaj Jha No, the ID is z13oefm53vexerhoc04cd13iiyqnxdopays0k
AFAIK the easiest way to get this ID is by calling activities.list() providing my (or anyone else's) userID. (edit) +Gerwin Sturm was faster ;-)

By Jalaj Jha Posted at 14:47 (05.10.2011) UTC+2

+Gerwin Sturm & +Martin Matysiak thanks a lot... got it by both ways... am highly inspired... thinking of what to make using these APIs

test`? edited: Very impressive!

Test comment, please ignore.

and the activityID associated with a particular URL ?
I would like to provide a URL and get a list of people (Google+ ID's) who have plus one'd that URL? (like www.site.xx/test.html)

+Alessandro Rossi No, as far as I know you can only get the plusoners for a real Google+ activity right now. +1's which are made on a website aren't associated with a specific activityID (at least with no one which we can use).

Interesting... Testing it out...

Impressive..testing it out

Nice & fun work using the api!

tes

By anasse aou Posted at 03:57 (02.01.2015) UTC+2

n

Testing 123