people
userID
<script src="https://apis.google.com/js/client.js?onload=CALLBACK"></script>
gapi.client.load('API_NAME', 'API_VERSION', CALLBACK);// Returns a request object which can then be executed.// METHOD_NAME is only available once CALLBACK runs.var request = gapi.client.METHOD_NAME(PARAMETERS_OBJECT); request.execute(callback);
plus.activities.search
<!DOCTYPE html><html> <head> </head> <body> <script type="text/javascript">function init() { // Load your API key from the Developer Console gapi.client.setApiKey('YOUR_API_KEY'); // Load the API gapi.client.load('plus', 'v1', function() { var request = gapi.client.plus.activities.search({ 'query': 'Google+', 'orderby': 'best' }); request.execute(function(resp) { // Output title var heading = document.createElement('h4'); heading.appendChild(document.createTextNode( resp.title)); var content = document.getElementById('content'); content.appendChild(heading); // Output content of the response if (!resp.items) { content.appendChild(document.createTextNode( 'No results found.')); } else { for (var i = 0; i < resp.items.length; i++) { var entry = document.createElement('p'); entry.appendChild(document.createTextNode( resp.items[i].title)); content.appendChild(entry); } } }); }); } </script> <script src="https://apis.google.com/js/client.js?onload=init"></script> <div id="content"></div> </body></html>
// Set up the HTTP transport and JSON factoryHttpTransport httpTransport = new NetHttpTransport();JsonFactory jsonFactory = new JacksonFactory();// Set up OAuth 2.0 access of protected resources // using the refresh and access tokens, automatically // refreshing the access token when it expiresGoogleAccessProtectedResource requestInitializer = new GoogleAccessProtectedResource(accessToken, httpTransport, jsonFactory, clientId, clientSecret, refreshToken);// Set up the main Google+ classPlus plus = new Plus(httpTransport, requestInitializer, jsonFactory);// Make a request to access your profile and display it to consolePerson profile = plus.people().get("me").execute();System.out.println("ID: " + profile.getId());System.out.println("Name: " + profile.getDisplayName());System.out.println("Image URL: " + profile.getImage().getUrl());System.out.println("Profile URL: " + profile.getUrl());