Google Drive SDK

Replies: get

Gets a reply. Try it now or see an example.

Request

HTTP request

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

Parameters

Parameter name Value Description
Path parameters
commentId string The ID of the comment.
fileId string The ID of the file.
replyId string The ID of the reply.
Optional query parameters
includeDeleted boolean If set, this will succeed when retrieving a deleted reply. (Default: false)

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a Replies 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

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

import java.io.IOException;
// ...

public class MyClass {

  // ...

  /**
   * Print information about the specified reply.
   *
   * @param service Drive API service instance.
   * @param fileId ID of the file to print reply for.
   * @param commentId ID of the comment to print reply for.
   * @param replyId ID of the reply to print.
   */
  private static void printReply(Drive service, String fileId,
      String commentId, String replyId) {
    try {
      CommentReply reply = service.replies().get(
          fileId, commentId, replyId).execute();

      System.out.println("Modified Date: " + reply.getModifiedDate());
      System.out.println("Author: " + reply.getAuthor());
      System.out.println("Content: " + reply.getContent());
    } catch (IOException e) {
      System.out.println("An error occurred: " + e);
    }
  }

  // ...

}

.NET

Uses the .NET client library

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

using System.Net;
// ...

public class MyClass {

  // ...

  /// <summary>Print information about the specified reply.</summary>
  /// Drive API service instance.
  /// ID of the file to print reply for.
  /// ID of the comment to print reply for.
  /// ID of the reply to print.
  public static void PrintReply(DriveService service, String fileId,
      String commentId, String replyId) {
    try {
      CommentReply reply = service.Replies.Get(fileId, commentId, replyId).Fetch();

      Console.WriteLine("Modified Date: " + reply.ModifiedDate);
      Console.WriteLine("Author: " + reply.Author);
      Console.WriteLine("Content: " + reply.Content);
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...

}

PHP

Uses the PHP client library

/**
 * Print information about the specified reply.
 *
 * @param Google_DriveService $service Drive API service instance.
 * @param String $fileId ID of the file to print reply for.
 * @param String $commentId ID of the comment to print reply for.
 * @param String $replyId ID of the reply to print.
 */
function printReply($service, $fileId, $commentId, $replyId) {
  try {
    $reply = $service->replies->get($fileId, $commentId, $replyId);

    print "Modified Date: " . $reply->getModifiedDate();
    print "Author: " . $reply->getAuthor()->getDisplayName();
    print "Content: " . $reply->getContent();
  } catch (Exception $e) {
    print "An error occurred: " . $e->getMessage();
  }
}

Python

Uses the Python client library

from apiclient import errors
# ...

def print_reply(service, file_id, comment_id, reply_id):
  """Print information about the specified reply.

  Args:
    service: Drive API service instance.
    file_id: ID of the file to print reply for.
    comment_id: ID of the comment to print reply for.
    reply_id: ID of the reply to print.
  """
  try:
    reply = service.replies().get(
        fileId=file_id, commentId=comment_id, replyId=reply_id).execute()

    print 'Modified Date: %s' % reply['modifiedDate']
    print 'Author: %s' % reply['author']['displayName']
    print 'Content: %s' % reply['content']
  except errors.HttpError, error:
    print 'An error occurred: %s' % error

Ruby

Uses the Ruby client library

##
# Print information about the specified reply
#
# @param [Google::APIClient] client
#   Authorized client instance
# @param [String] file_id
#   ID of the file to print reply for
# @param [String] comment_id
#   ID of the comment to print reply for
# @param [String] reply_id
#   ID of the reply to print
# @return nil
def print_reply(client, file_id, comment_id, reply_id)
  drive = client.discovered_api('drive', 'v2')
  result = client.execute(
    :api_method => drive.replies.get,
    :parameters => {
      'fileId' => file_id,
      'commentId' => comment_id,
      'replyId' => reply_id
    })
  if result.status == 200
    reply = result.data
    puts "Modified Date: #{reply.modified_date}"
    puts "Author: #{reply.author}"
    puts "Content: #{reply.content}"
  else
    puts "An error occurred: #{result.data['error']['message']}"
  end
end

JavaScript

Uses the JavaScript client library

/**
 * Print information about the specified reply.
 *
 * @param {String} fileId ID of the file to print reply for.
 * @param {String} commentId ID of the comment to print reply for.
 * @param {String} replyId ID of the reply to print.
 */
function printReply(fileId, commentId, replyId) {
  var request = gapi.client.drive.replies.get({
    'fileId': fileId,
    'commentId': commentId,
    'replyId': replyId
  });
  request.execute(function(resp) {
    console.log('Modified Date: ' + resp.modifiedDate);
    console.log('Author: ' + resp.author.displayName);
    console.log('Content: ' + resp.content);
  });
}

Try it!

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

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.