Requires authorization
List all of the people in the specified collection. Try it now or see an example.
Request
HTTP request
GET https://www.googleapis.com/plus/v1/people/userId/people/collection
Parameters
| Parameter name | Value | Description |
|---|---|---|
| Path parameters | ||
collection |
string |
The collection of people to list.
Acceptable values are:
|
userId |
string |
Get the collection of people for the person identified. Use "me" to indicate the authenticated user. |
| Optional query parameters | ||
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 100, inclusive.
(Default: 100)
|
orderBy |
string |
The order to return people in.
Acceptable values are:
|
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. |
Authorization
This request requires authorization with at least one of the following scopes (read more about authentication and authorization).
| Scope |
|---|
https://www.googleapis.com/auth/plus.login |
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". |
|
etag |
etag |
ETag of this response for caching purposes. | |
selfLink |
string |
Link to this resource. | |
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. | |
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. | |
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. |
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.List listPeople = plus.people().list(
"me", "visible");
listPeople.setMaxResults(5L);
PeopleFeed peopleFeed = listPeople.execute();
List<Person> people = peopleFeed.getItems();
// Loop through until we arrive at an empty page
while (people != null) {
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
listPeople.setPageToken(peopleFeed.getNextPageToken());
// Execute and process the next page request
peopleFeed = listPeople.execute();
people = peopleFeed.getItems();
}
.NET
Uses the .NET 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/csharp
PeopleResource.Collection collection = new PeopleResource.Collection("visible");
PeopleResource.ListRequest listRequest = plusService.People.List("me", collection);
return listRequest.Fetch();
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
response = $client.execute!(plus.people.list,
:userId => 'me',
:collection => 'visible').body
Go
Uses the Go client library.
people, err := plusService.People.List("me", "visible").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.list({
'userId' : 'me', 'collection' : 'visible' }); 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.