GETGet all posts. Supports ?limit&skip.
🔗 GET https://dummyapi.codesmash.in/api/posts
?limit?skip
fetch('https://dummyapi.codesmash.in/api/posts')
.then(res => res.json())
.then(console.log);
ℹ️Pagination — By default you will get 30 items. Use ?limit and ?skip to paginate through all items. Max limit is 200.
?limit=10Number of items to return (default: 30, max: 200)
?skip=10Number of items to skip (default: 0)
// By default you get 30 items
fetch('https://dummyapi.codesmash.in/api/posts?limit=10&skip=0')
.then(res => res.json())
.then(console.log);
// Get next page (items 11–20)
fetch('https://dummyapi.codesmash.in/api/posts?limit=10&skip=10')
.then(res => res.json())
.then(console.log);
// Get ALL 200 at once
fetch('https://dummyapi.codesmash.in/api/posts?limit=200')
.then(res => res.json())
.then(console.log);
GET https://dummyapi.codesmash.in/api/posts/:id
fetch('https://dummyapi.codesmash.in/api/posts/:id')
.then(res => res.json())
.then(console.log);
GETSearch posts by title or body.
🔗 GET https://dummyapi.codesmash.in/api/posts/search?q=
fetch('https://dummyapi.codesmash.in/api/posts/search?q=')
.then(res => res.json())
.then(console.log);
GETGet all posts by a user.
🔗 GET https://dummyapi.codesmash.in/api/posts/user/:id
fetch('https://dummyapi.codesmash.in/api/posts/user/:id')
.then(res => res.json())
.then(console.log);
POSTCreate a new post (demo).
🔗 POST https://dummyapi.codesmash.in/api/posts
fetch('https://dummyapi.codesmash.in/api/posts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
})
.then(res => res.json())
.then(console.log);
PUT https://dummyapi.codesmash.in/api/posts/:id
fetch('https://dummyapi.codesmash.in/api/posts/:id', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
})
.then(res => res.json())
.then(console.log);
DELETE https://dummyapi.codesmash.in/api/posts/:id
fetch('https://dummyapi.codesmash.in/api/posts/:id', {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
})
.then(res => res.json())
.then(console.log);