Get comments for a post

GET /posts/{postId}/comments
Returns all comments on a specific post.

Path Parameters

NameTypeDescription
postId requiredintegerPost ID

Responses

A list of comments

array<Comment> application/json
NameTypeDescription
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();