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?!
Please go to Google+ to comment on this post.
Sound like a (the?) first useful usage of new API functionality.
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 ;-)
: unfortunately it doesn't seem to work as I thought it would. But I'll keep that idea in mind. : thanks! looks promising!
tnx for trying
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. :)
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'thave something similar using the Buzz API? Been a while so it might have been someone else as well...
let me try.. testing..
+Gerwin Sturm yes I did it for buzz. It doesn't look too hard to do for plus now either
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
http://code.google.com/p/google-plus-platform/issues/detail?id=8) would be nice to see. This would save a lot of requests but still provide a up-to-date comment feed.Yes, currently a new query is sent upon every visit. Right now I have no problem with the query limits, but in the long term, Push notifications (see plus platform issue 8
am bit confused with activity-id (just started with API) what's the id for this post? JqbwHdEt6Hg?
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 assaid (edit: will say ;) ) you can fetch your ActivityList and get the ID from there.
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) was faster ;-)
& 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)
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).
thanks for the answer
Interesting... Testing it out...
Impressive..testing it out
Nice & fun work using the api!