Nhận xét: nhận

Truy xuất một tài nguyên nhận xét theo commentId của nó. Thử ngay hoặc xem ví dụ.

Cần có uỷ quyền nếu nhận xét nằm trên một blog riêng tư. Nếu nhận xét nằm trên một blog công khai, thì phương thức này có thể được gọi mà không cần uỷ quyền.

Yêu cầu

Yêu cầu HTTP

GET https://www.googleapis.com/blogger/v3/blogs/blogId/posts/postId/comments/commentId

Các tham số

Tên thông số Giá trị Mô tả
Các thông số bắt buộc
blogId string Mã của blog chứa bình luận đó.
commentId string Mã của bình luận mà bạn muốn nhận.
postId string Mã của bài đăng để tìm nạp bình luận.

Nội dung yêu cầu

Đừng cung cấp nội dung yêu cầu bằng phương thức này.

Phản hồi

Nếu thành công, phương thức này sẽ trả về một Tài nguyên nhận xét trong nội dung phản hồi.

Ví dụ

Lưu ý: Các đoạn mã mẫu của phương thức này không phải là ví dụ cho mọi ngôn ngữ lập trình được hỗ trợ (xem trang thông tin về các thư viện dùng cho ứng dụng để biết danh sách các ngôn ngữ được hỗ trợ).

Java

Sử dụng thư viện ứng dụng Java

// The BlogId for the http://buzz.blogger.com/ blog.
String BUZZ_BLOG_ID = "2399953";
// The PostId for a buzz post with comments.
String BUZZ_POST_ID = "5310628572012276714";
// The CommentId for a comment on the above post.
String BUZZ_COMMENT_ID = "6352433676268819946";
// Configure the Java API Client for Installed Native App
HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
// Configure the Installed App OAuth2 flow.
Credential credential = OAuth2Native.authorize(HTTP_TRANSPORT,
JSON_FACTORY, new LocalServerReceiver(),
Arrays.asList(BloggerScopes.BLOGGER));
// Construct the Blogger API access facade object.
Blogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)
.setApplicationName("Blogger-CommentsGet-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// The request action.
Get commentsGetAction = blogger.comments().get(BUZZ_BLOG_ID,
BUZZ_POST_ID, BUZZ_COMMENT_ID);
// Restrict the result content to just the data we need.
commentsGetAction.setFields("author/displayName,content");
// This step sends the request to the server.
Comment comment = commentsGetAction.execute();
// Now we can navigate the response.
System.out.println("Display Name: " + comment.getAuthor().getDisplayName());
System.out.println("Content: " + comment.getContent());

Hãy dùng thử!

Hãy dùng API Explorer bên dưới để gọi phương thức này trên dữ liệu trực tiếp và xem phản hồi.