Pages

6.10.11

Google+ releases API focused on search

Google released a new application programming interface (API) for Google+ today. The API gives developers access to Google+’s search functions. The API remains public-focused and will only allow developers to access public posts as well as people.

Developers use APIs to access data within another program, such as social data, to improve their own third party applications.

Google launched its first set of APIs for Google+ mid-September and soon thereafter introduced the search feature in a sweep of additions. Its second API announcement, this time for access to Google+ video chat feature Hangouts, came in tandem with that announcement.The current Google+ search function provides you with relevant people and posts pertaining to your keyword query, and also relevant matches from the web.

Search for it  
copy the code
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

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]

“As an API developer, I love seeing what people build on top of the APIs I’ve worked on,” said Jordanna Chord, a software engineer for the Google+ API team, said in the blog post. “We have been reading your posts on the discussion board and issue tracker and I am excited to see more of your creative ideas.”

No comments:

Post a Comment