List posts
GET
/postsReturns all posts. Supports filtering by user.
Query Parameters
| Name | Type | Description |
|---|---|---|
userId ? | integer | Filter posts by user ID |
Responses
A list of posts
| Name | Type | Description |
|---|---|---|
userId ? | integer | |
id ? | integer | |
title ? | string | |
body ? | string |
curl -X GET 'https://jsonplaceholder.typicode.com/posts'const response = await fetch('https://jsonplaceholder.typicode.com/posts', {
method: 'GET',
headers: { 'Accept': 'application/json' }
});
const data = await response.json();