Google+ Platform

People: get

Get a person's profile. If your app uses scope https://www.googleapis.com/auth/plus.login, this method is guaranteed to return ageRange and language. Try it now or see an example.

If using the userId value "me", this method requires authentication using a token that has been granted the OAuth scope https://www.googleapis.com/auth/plus.login or https://www.googleapis.com/auth/plus.me. Read more about OAuth.

Request

HTTP request

GET https://www.googleapis.com/plus/v1/people/userId

Parameters

Parameter name Value Description
Required parameters
userId string The ID of the person to get the profile for. The special value "me" can be used to indicate the authenticated user.

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a person resource in the response body.

Examples

Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).

Java

Uses the Java client library

// This sample assumes a client object has been created.
// To learn more about creating a client, check out the starter:
//  https://developers.google.com/+/quickstart/java
Person mePerson = plus.people().get("me").execute();

System.out.println("ID:\t" + mePerson.getId());
System.out.println("Display Name:\t" + mePerson.getDisplayName());
System.out.println("Image URL:\t" + mePerson.getImage().getUrl());
System.out.println("Profile URL:\t" + mePerson.getUrl());

PHP

Uses the PHP client library

# This sample assumes a client object has been created.
# To learn more about creating a client, check out the starter:
#  https://developers.google.com/+/quickstart/php

$me = $plus->people->get('me');
print "ID: {$me['id']}\n";
print "Display Name: {$me['displayName']}\n";
print "Image Url: {$me['image']['url']}\n";
print "Url: {$me['url']}\n";

Python

Uses the Python client library

# This sample assumes a client object has been created.
# To learn more about creating a client, check out the starter:
#  https://developers.google.com/+/quickstart/python

people_resource = service.people()
people_document = people_resource.get(userId='me').execute()

print "ID: " + people_document['id']
print "Display name: " + people_document['displayName']
print "Image URL: " + people_document['image']['url']
print "Profile URL: " + people_document['url']

Ruby

Uses the Ruby client library

# This sample assumes a client object has been created.
# To learn more about creating a client, check out the starter:
#  https://developers.google.com/+/quickstart/ruby

status, headers, body = client.execute(
  plus.people.get,
  {'userId' => id})

profile = JSON.parse(body[0])

return status if status != 200

puts "ID:\t#{profile['id']}"
puts "Display Name:\t#{profile['displayName']}"
puts "Image URL:\t#{profile['image']['url']}"
puts "Profile URL:\t#{profile['url']}"

Go

Uses the Go client library

person, err := plusService.People.Get("me").Do()

JavaScript

Uses the JavaScript client library

// This sample assumes a client object has been created.
// To learn more about creating a client, check out the starter:
//  https://developers.google.com/+/quickstart/javascript
var request = gapi.client.plus.people.get({
'userId' : 'me' }); request.execute(function(resp) { console.log('ID: ' + resp.id); console.log('Display Name: ' + resp.displayName); console.log('Image URL: ' + resp.image.url); console.log('Profile URL: ' + resp.url); });

Try it!

Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.