Get post by ID
GET
/posts/{postId}Returns a single post by its ID.
Path Parameters
| Name | Type | Description |
|---|---|---|
postId required | integer | Post ID |
Responses
Post details
| Name | Type | Description |
|---|---|---|
userId ? | integer | |
id ? | integer | |
title ? | string | |
body ? | string |
Post not found
curl -X GET 'https://jsonplaceholder.typicode.com/posts/{postId}'const response = await fetch('https://jsonplaceholder.typicode.com/posts/{postId}', {
method: 'GET',
headers: { 'Accept': 'application/json' }
});
const data = await response.json();