Google+ Platform

People: search

Search all public profiles. Try it now or see an example.

For large result sets, results are paginated. For the most up-to-date search results, do not use a pageToken older than five minutes. Instead, restart pagination by repeating the original request (omitting pageToken).

To search activities, see activities search.

Request

HTTP request

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

Parameters

Parameter name Value Description
Required parameters
query string Specify a query string for full text search of public text in all profiles.
Optional parameters
language string Specify the preferred language to search with. See search language codes for available values.
maxResults unsigned integer The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults. Acceptable values are 1 to 50, inclusive. (Default: 25)
pageToken string The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. This token can be of any length.

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "plus#peopleFeed",
  "etag": etag,
  "selfLink": string,
  "title": string,
  "nextPageToken": string,
  "totalItems": integer,
  "items": [
    people Resource
  ]
}
Property name Value Description Notes
kind string Identifies this resource as a collection of people. Value: "plus#peopleFeed".
title string The title of this collection of people.
nextPageToken string The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results.
items[] list The people in this page of results. Each item includes the id, displayName, image, and url for the person. To retrieve additional profile data, see the people.get method.
etag etag ETag of this response for caching purposes.
totalItems integer The total number of people available in this list. The number of people in a response might be smaller due to paging. This might not be set for all collections.

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

Plus.People.Search searchPeople = plus.people().search("Brett");
searchPeople.setMaxResults(5L);

PeopleFeed peopleFeed = searchPeople.execute();
List<Person> people = peopleFeed.getItems();

// Loop through until we arrive at an empty page, or the second page
int pageNumber = 1;
while (people != null && pageNumber <= 2) {
  pageNumber++;
  
  for (Person person : people) {
    System.out.println(person.getDisplayName());
  }

  // We will know we are on the last page when the next page token is null.
  // If this is the case, break.
  if (peopleFeed.getNextPageToken() == null) {
    break;
  }

  // Prepare the next page of results
  searchPeople.setPageToken(peopleFeed.getNextPageToken());

  // Execute and process the next page request
  peopleFeed = searchPeople.execute();
  people = peopleFeed.getItems();
}

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

$optParams = array('maxResults' => 5);
$results = $plus->people->search('Brett', $optParams);
foreach ( $results['items'] as $result ) {
  print "ID: {$result['id']}\n<br>";
  print "Display Name: {$result['displayName']}\n<br>";
  print "Image Url: {$result['image']['url']}\n<br>";
  print "Url: {$result['url']}\n<br>";
}

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.search( \
    maxResults=10,query='Jenny').execute()

if 'items' in people_document:
  print 'got page with %d' % len( people_document['items'] )
  for person in people_document['items']:
    print person['id'], person['displayName']

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.search,
  {'query' => 'Jenny'})

return status if status != 200

response = JSON.parse(body[0])

people = response[ 'items' ]

# Print out the collected comments
if ( !people.nil? )
  for person in people
    puts "Found Jenny: #{person['id']} with content #{person['displayName']}"
  end
end

Go

Uses the Go client library

people, err := plusService.People.Search("Brett").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.search({
'query' : 'silvano' }); request.execute(function(resp) { var numItems = resp.items.length; for (var i = 0; i < numItems; i++) { console.log(resp.items[i].displayName); } });

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.