Unique identifier for the comment
GET
/posts/{id}/commentsGet Post Comments
Retrieve all comments for a specific blog post by post ID including commenter details and comment body
Overview
Retrieves all comments associated with a specific blog post.
Path Parameters
Path Parameters
id requiredThe ID of the post to get comments for
Response
Returns an array of comment objects.
id integerpostId integerID of the post this comment belongs to
name stringTitle or subject of the comment
email stringEmail address of the commenter
body stringContent of the comment
Related Endpoints
Get Post Details
View the full post that these comments belong to
Error Responses
| Status | Description |
|---|---|
404 | Post not found - the specified post ID does not exist |
curl -X GET "https://jsonplaceholder.typicode.com/posts/1/comments"const response = await fetch("https://jsonplaceholder.typicode.com/posts/1/comments");const data = await response.json();console.log(data);import requests
response = requests.get("https://jsonplaceholder.typicode.com/posts/1/comments")print(response.json())[ { "postId": 1, "id": 1, "name": "id labore ex et quam laborum", "body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium" }, { "postId": 1, "id": 2, "name": "quo vero reiciendis velit similique earum", "body": "est natus enim nihil est dolore omnis voluptatem numquam\net omnis occaecati quod ullam at\nvoluptatem error expedita pariatur\nnihil sint nostrum voluptatem reiciendis et" }]{ "error": "Post not found"}Was this page helpful?
Request
curl -X GET "https://jsonplaceholder.typicode.com/posts/{id}/comments" \
-H "Content-Type: application/json"const response = await fetch("https://jsonplaceholder.typicode.com/posts/{id}/comments", {
method: "GET",
headers: {
"Content-Type": "application/json"
},
});
const data = await response.json();
console.log(data);import requests
response = requests.get(
"https://jsonplaceholder.typicode.com/posts/{id}/comments",
headers={'Content-Type':'application/json'},
)
print(response.json())package main
import (
"fmt"
"net/http"
"io"
)
func main() {
req, _ := http.NewRequest("GET", "https://jsonplaceholder.typicode.com/posts/{id}/comments", nil)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}Response
Send a request to see the response
Headers
Response