Google+ APIs: Now With Search and More!

Tuesday, October 4, 2011 | 11:09 AM

Thank you to all of you who tried out our first Google+ API release and let us know how you were using it. And thank you also to those of you who asked for more. In the spirit of releasing early and often, today we’ve released some of the new features that you requested.

Search for it

Last month we launched search in Google+, and now it’s available in the API. You can search for public posts using the new activities.search method by sending the following HTTP request:

GET 
https://www.googleapis.com/plus/v1/activities?query=cookie%20recipes&orderBy=best&key=[yourAPIKey]

This method searches across the body and comments of public posts. It returns the following JSON encoded output (excerpted for brevity):

{
 "kind": "plus#activityFeed",
 "title": "Plus Search for cookie recipes",
 "updated": "2011-09-30T16:57:34.479Z",
 "id": "tag:google.com,2010:buzz-search-feed:x4rIYTKpR7NZCL8Id8RHXQ",
 "items": [
  {
   "kind": "plus#activity",
   “id”: “123”,
   "title": "You have to try these out.",
   "object": {
    "objectType": "note",
    "content": "I’m baking halloween cookies!",
   },
   {
   "kind": "plus#activity",
   “id”: “456”,
   "title": "Cookies",
   "object": {
    "objectType": "note",
    "content": "Cookies and milk for dinner. Don’t judge me.",
   },
 ]
}

You can search for people by using the people.search method:

GET https://www.googleapis.com/plus/v1/people?query=vic%20gundotra&key=[yourAPIKey]

This searches across public profile information including fields such as name, bio, location, tag line, and description.

The rest of the conversation

Our first API release let you retrieve public posts. We’ve now added ways for you to see how people are publicly engaging with those posts -- you can find out who reshared a post or who +1’d a post, and you can read the comments on a post.

The new method people.listByActivity supports retrieving resharers and +1’ers by sending the following HTTP requests:

GET https://www.googleapis.com/plus/v1/activities/{activityId}/people/resharers?key=[yourAPIKey]
GET https://www.googleapis.com/plus/v1/activities/{activityId}/people/plusoners?key=[yourAPIKey]

And comments can be retrieved by the new comments.list and comments.get methods:

GET https://www.googleapis.com/plus/v1/activities/{activityId}/comments?key=[yourAPIKey]
GET https://www.googleapis.com/plus/v1/comment/{commentId}?key=[yourAPIKey]

Tell us what you think

As an API developer, I love seeing what people build on top of the APIs I’ve worked on. We have been reading your posts on the Discussion Board and issue tracker and I am excited to see more of your creative ideas. We will continue incorporating your feedback into our design discussions, so please keep it coming.

Follow the conversation on Google+.

0 comments: