Replies: list

Stay organized with collections Save and categorize content based on your preferences.

Lists all of the replies to a comment. Try it now or see an example.

Request

HTTP request

GET https://www.googleapis.com/drive/v2/files/fileId/comments/commentId/replies

Parameters

Parameter name Value Description
Path parameters
commentId string The ID of the comment.
fileId string The ID of the file.
Optional query parameters
includeDeleted boolean If set, all replies, including deleted replies (with content stripped) will be returned. (Default: false)
maxResults integer The maximum number of replies to include in the response, used for paging. Acceptable values are 0 to 100, inclusive. (Default: 20)
pageToken string The continuation token, 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 allows authorization with at least one of the following scopes:

Scope
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.file

Some scopes are restricted and require a security assessment for your app to use them. For more information, see the authentication and authorization page.

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": "drive#commentReplyList",
  "selfLink": string,
  "nextPageToken": string,
  "nextLink": string,
  "items": [
    replies Resource
  ]
}
Property name Value Description Notes
kind string This is always drive#commentReplyList.
nextPageToken string The page token for the next page of replies. This will be absent if the end of the replies list has been reached. If the token is rejected for any reason, it should be discarded, and pagination should be restarted from the first page of results.
items[] list The list of replies. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched.

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.

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.model.CommentReply;
import com.google.api.services.drive.model.CommentReplyList;

import java.io.IOException;
import java.util.List;

// ...

public class MyClass {

  // ...

  /**
   * Retrieve a list of replies.
   *
   * @param service Drive API service instance.
   * @param fileId ID of the file to retrieve replies for.
   * @param commentId ID of the comment to retrieve replies for.
   * @return List of replies.
   */
  private static List<CommentReply><reply> retrieveReplies(Drive service,
      String fileId, String commentId) {
    try {
      CommentReplyList replies = service.replies().list(fileId, commentId).execute();
      return replies.getItems();
    } catch (IOException e) {
      System.out.println("An error occurred: " + e);
    }
    return null;
  }

  // ...

}</reply>

.NET

Uses the .NET client library.

using Google.Apis.Drive.v2;
using Google.Apis.Drive.v2.Data;

using System.Collections.Generic;
// ...

public class MyClass {

  // ...

  /// <summary>
  /// Retrieve a list of replies.
  /// </summary>
  /// <param name="service">Drive API service instance.</param>
  /// <param name="fileId">ID of the file to retrieve replies for.</param>
  /// <param name="commentId">ID of the comment to retrieve replies for.</param>
  /// <returns>List of replies.</returns>
  public static IList<CommentReply><Reply> RetrieveReplies(
      DriveService service, String fileId, String commentId) {
    try {
      CommentReplyList replies = service.Replies.List(fileId, commentId).Execute();
      return replies.Items;
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
    return null;
  }

  // ...

}

PHP

Uses the PHP client library.

/**
 * Retrieve a list of replies.
 *
 * @param Google_Service_Drive $service Drive API service instance.
 * @param String $fileId ID of the file to retrieve replies for.
 * @param String $commentId ID of the comment to retrieve replies for.
 * @return Array List of Google_Servie_Drive_CommentReply resources.
 */
function retrieveReplies($service, $fileId, $commentId) {
  try {
    $replies = $service->replies->listReplies($fileId, $commentId);
    return $replies->getItems();
  } catch (Exception $e) {
    print "An error occurred: " . $e->getMessage();
  }
  return NULL;
}

Python

Uses the Python client library.

from apiclient import errors
# ...

def retrieve_replies(service, file_id, comment_id):
  """Retrieve a list of replies to a comment.

  Args:
    service: Drive API service instance.
    file_id: ID of the file to retrieve replies for.
    comment_id: ID of the comment to retrieve replies for.
  Returns:
    List of replies.
  """
  try:
    replies = service.replies().list(
        fileId=file_id, commentId=comment_id).execute()
    return replies.get('items', [])
  except errors.HttpError, error:
    print 'An error occurred: %s' % error
  return None

JavaScript

Uses the JavaScript client library.

/**
 * Retrieve a list of replies.
 *
 * @param {String} fileId ID of the file to retrieve replies for.
 * @param {String} commentId ID of the comment to retrieve replies for.
 * @param {Function} callback Function to call when the request is complete.
 */
function retrieveReplies(fileId, commentId, callback) {
  var request = gapi.client.drive.replies.list({
    'fileId': fileId,
    'commentId': commentId
  });
  request.execute(callback);
}

Try it!

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