Get comments for a post
GET
/posts/{postId}/commentsReturns all comments on a specific post.
Path Parameters
| Name | Type | Description |
|---|---|---|
postId required | integer | Post ID |
Responses
A list of comments
| Name | Type | Description |
|---|---|---|
postId ? | integer | |
id ? | integer | |
name ? | string | |
email ? | string | |
body ? | string |
curl -X GET 'https://jsonplaceholder.typicode.com/posts/{postId}/comments'const response = await fetch('https://jsonplaceholder.typicode.com/posts/{postId}/comments', {
method: 'GET',
headers: { 'Accept': 'application/json' }
});
const data = await response.json();