Building on the Google Buzz API

Hello
Timothy Jordan Developer Advocate, Google buzz.timothyjordan.com @timothyjordan #devfest

Agenda

• Buzz API Overview • OACurl • Endpoints of note • Track • Firehose • Questions and Answers

Buzz API Review

Warning!

https://www.googleapis.com/buzz/v1/

Params

alt • alt=atom returns an Atom representation of the data. • alt=json returns a JSON representation of the data. prettyprint • If prettyprint=true, the results • Default: prettyprint=false

returned by the server will be human readable

https://www.googleapis.com/buzz/v1/activities/@me/@self?alt=json&prettyprint=true

Params

• preview=true • max-results=N • • •

preview the operation. maximum number of results. max-liked=N maximum number of likes max-comments=N maximum number of comments c={token} continuation token

https://www.googleapis.com/buzz/v1/activities/@me/@self?max-results=20&c={token}

Params

• q={query} • lat, lon, radius • bbox

search. geo location. bounding box.

https://www.googleapis.com/buzz/v1/activities/search?q={q}&lat={l}&lon={l}&radius={r}

Activity Streams

Actor Verb Object

Timothy Posts A Note

     "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com, 2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4?alt\u003djson",      "type": "json"     }    ],    "replies": [     {      "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",      "type": "application/json",      "count": 2,      "updated": "2010-05-09T02:53:13.730Z"     }    ]   },

  "actor": {    "id": "{id}",    "name": "Timothy Jordan",    "profileUrl": "{url}/captaintimothy",    "thumbnailUrl": "{url}/captaintimothy/thumb.jpg"   },
  "verbs": [    "post"   ],   "object": {    "type": "note",    "content": "content goes here",    "links": {     "alternate": [      {       "href": "http://www.google.com/buzz/a/google.com",       "type": "text/html"      }     ]    }   },

    }    ],    "replies": [     {      "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",      "type": "application/json",      "count": 2,      "updated": "2010-05-09T02:53:13.730Z"     }    ]   },   "actor": {    "id": "{id}",    "name": "Timothy Jordan",    "profileUrl": "{url}/captaintimothy",    "thumbnailUrl": "{url}/captaintimothy/thumb.jpg"   },

  "verbs": [    "post"   ],
  "object": {    "type": "note",    "content": "content goes here",    "links": {     "alternate": [      {       "href": "http://www.google.com/buzz/a/google.com",       "type": "text/html"      }     ]    }   },   "source": {    "title": "Buzz"   },   "visibility": {    "entries": [

     "type": "json"     }    ],    "replies": [     {      "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",      "type": "application/json",      "count": 2,      "updated": "2010-05-09T02:53:13.730Z"     }    ]   },   "actor": {    "id": "{id}",    "name": "Timothy Jordan",    "profileUrl": "{url}/captaintimothy",    "thumbnailUrl": "{url}/captaintimothy/thumb.jpg"   },   "verbs": [    "post"   ],

  "object": {    "type": "note",    "content": "content goes here"    }   },
  "source": {    "title": "Buzz"   },   "visibility": {    "entries": [     {      "id": "https://www.googleapis.com/buzz/v1/people/@me/@groups/@public?alt\u003djson",      "title": "Public"     }    ]   }  }

{   "kind": "buzz#activity",

  "title": "note to self",   "published": "2010-05-09T02:53:13.000Z",   "updated": "2010-05-09T02:53:13.730Z",    "id": "tag:google.com,2010:buzz:foo",
  "links": {    "liked": [     {      "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com, 2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4/@liked?alt\u003djson",      "type": "application/json",      "count": 0     }    ],    "alternate": [     {      "href": "http://www.google.com/buzz/a/google.com",      "type": "text/html"     }    ],    "self": [     {      "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com, 2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4?alt\u003djson",

OACurl

OACurl

bit.ly/oacurl-1-0-0

bit.ly/oacurl-cookbook

OACurl
1.Download and install java 1.6 2.Download oacurl

bit.ly/oacurl-1-0-0
3.Goto the directory you downloaded oacurl-1.0.0.jar

% cd <location of oacurl-1.0.0.jar>
4.Login using oacurl

% java -cp ./oacurl-1.0.0.jar com.google.oacurl.Login -buzz
5.Fetch a user's consumption stream

% java -cp ./oacurl-1.0.0.jar com.google.oacurl.Fetch https://www.googleapis.com/buzz/v1/activities/@me/ @consumption?prettyprint=true

OACurl

% alias oacurl='java -cp ./oacurl-1.0.0.jar com.google.oacurl.Fetch'

% alias oacurl-login='java -cp ./oacurl-1.0.0.jar com.google.oacurl.Login'

Endpoints of note
Including some new stuff!

User public feed
https://www.googleapis.com/buzz/v1/activities/userId/@public

• Returns all public activities posted by a specific user

User Consumption Feed
https://www.googleapis.com/buzz/v1/activities/userId/@consumption

• Returns activities posted by others, intended for the authenticated user's
consumption.

• Activities posted by people that the user is following • Activities in which the user has been mentioned.

Comments by the user
https://www.googleapis.com/buzz/v1/activities/userId/@comments

• Requires authentication • Returns activities that the user has commented on

Get count of link shares
https://www.googleapis.com/buzz/v1/activities/count?url=url

• Returns the number of times a URL has been shared on Google Buzz • Multiple URLs may be requested by including the url parameter multiple times.
https://www.googleapis.com/buzz/v1/activities/count? url=http://www.google.com/&url=http://code.google.com/

Search for people by topic
https://www.googleapis.com/buzz/v1/activities/search/@people? q=query&lat=latitude&lon=longitude&radius=radius

• Return users that have posted about a particular search term • Supports all of the same parameters as the activity search endpoint including, • Advanced keyword search using the q parameter • Geographic search using the lat, lon, radius, and bbox parameters.

Related Links for an activity
https://www.googleapis.com/buzz/v1/activities/userId/@self/activityId/@related

• Returns links to web pages related to an activity • Determine these links by • Extracting the salient topics from the post • Searching the web to find results related to those topics

Track

Track
https://www.googleapis.com/buzz/v1/activities/track? q=query&lat=latitude&lon=longitude&radius=radius

• PSHB Real-time updates from a filtered version of the firehose • Supports all of the same parameters as the activity search endpoint • Take control of real-time serendipity

Firehose

Firehose

Photo credit: Nandhp, used under the Creative Commons Attribution-Share Alike 3.0 Unported license.

Gardenhose

Firehose
https://www.googleapis.com/buzz/v1/activities/@all/@public

• Hub Discovery • Subscribe • Verify Subscription • Receive Updates

Firestarter / Gardenstarter

https://code.google.com/p/buzz-codelabs/

Questions and Answers

Questions and Answers

Timothy Jordan Developer Advocate, Google buzz.timothyjordan.com @timothyjordan #devfest

Links

https://code.google.com/apis/buzz/docs/ http://code.google.com/p/oacurl/ http://code.google.com/p/buzz-php-client/ http://code.google.com/p/buzz-python-client/ http://code.google.com/p/buzz-java-client/ code.google.com/p/buzz-codelabs code.google.com/p/buzz-mood

Sign up to vote on this title
UsefulNot useful