We had to wait a bit but the google+ API was officially launched yesterday. Only public data and posts can be accessed, but it is a start to get familiar with the API.

Simple Facebook API like start

Building an app is similar to the Facebook API. You start registering an app. When you put the obtained keys/secret in your code, you can use oauth2 to authorize and obtain a token. Then you can access the data (JSON response)

Examples

A. You can load your profile data in an array referring to me:

$me = $plus->people->get('me');

* note the similarity to Facebook: $me = $facebook->api('/me');

Response:


B. Your public activities:

  $optParams = array('maxResults' => 100);
  $activities = $plus->activities->listActivities('me', 'public', $optParams);

There are a bunch of more advanced examples in the API libraries

Links

See the API reference. Some issues you might run into (for example, I had a missing .crt file, see this post)

Progress

As said, only public data can be gathered. However the fact that you can authorize with Oauth2  is much better then another method I tried some weeks ago. I am eager to learn what other functionalities will be available next ...


Bob Belderbos

Software Developer, Pythonista, Data Geek, Student of Life. About me