Google+ Platform

Moments: list

Requires authorization

List all of the moments that your app has written for the authenticated user. Try it now or see an example.

Request

HTTP request

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

Parameters

Parameter name Value Description
Path parameters
collection string The collection of moments to list.

Acceptable values are:
  • "vault": All moments created by the requesting application for the authenticated user.
userId string The ID of the user to get moments for. The special value "me" can be used to indicate the authenticated user.
Optional query parameters
maxResults unsigned integer The maximum number of moments 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: 20)
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.
targetUrl string Only moments containing this targetUrl will be returned.
type string Only moments of this type will be returned.

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#momentsFeed",
  "etag": etag,
  "nextPageToken": string,
  "selfLink": string,
  "nextLink": string,
  "title": string,
  "updated": datetime,
  "items": [
    moments Resource
  ]
}
Property name Value Description Notes
kind string Identifies this resource as a collection of moments. Value: "plus#momentsFeed".
etag etag ETag of this response for caching purposes.
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.
title string The title of this collection of moments.
updated datetime The RFC 339 timestamp for when this collection of moments was last updated.
items[] list The moments in this page of results.

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

// This example lists the moments that the current app wrote for the authorized user.
MomentsFeed moments = service.moments().list("me", "vault").execute();

.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

MomentsResource.ListRequest listRequest = new MomentsResource.ListRequest(
    plusService, userId, MomentsResource.CollectionEnum.Vault);
MomentsFeed momentsList = listRequest.Fetch();

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

# This example lists the moments that the current app wrote for the authorized user.
$moments = $plus->moments->listMoments('me', 'vault');

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

# This example lists the moments that the current app wrote for the authorized user.
moments = service.moments().list(userId='me', collection='vault').execute()

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.moments.list,
      :userId => 'me',
      :collection => 'vault').body

Go

Uses the Go client library

moments, err := plusService.Moments.List("me", "vault").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.moments.list({
'userId' : 'me', 'collection' : 'vault' }); request.execute(function(resp) { var numItems = resp.items.length; for (var i = 0; i < numItems; i++) { console.log(resp.items[i]); } });

Try it!

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

IMPORTANT! The APIs Explorer below does not currently work. It returns a "401 Unauthorized" error. The method itself works, but this explorer does not pass in the required data-requestvisibleactions. This is a known bug that we plan to fix.

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.