screen size not supported

Docs

You can use examples below to check how DummyJSON works.

Posts

Get all posts

              
fetch('https://dummyjson.com/posts')
.then(res => res.json())
.then(console.log);
            
           
Show output

Get a single post

              
fetch('https://dummyjson.com/posts/1')
.then(res => res.json())
.then(console.log);
            
           
Show output
              
fetch('https://dummyjson.com/posts/search?q=love')
.then(res => res.json())
.then(console.log);
            
           
Show output

Limit and skip posts

You can pass "limit" and "skip" params to limit and skip the results for pagination, and use limit=0 to get all items.
You can pass "select" as query params with comma-separated values to select specific data.

              
fetch('https://dummyjson.com/posts?limit=10&skip=10&select=title,reactions,userId')
.then(res => res.json())
.then(console.log);
            
           
Show output

Get all posts by user id

              
/* getting posts of user with id 5 */
fetch('https://dummyjson.com/posts/user/5')
.then(res => res.json())
.then(console.log);
            
           
Show output

Get post's comments

              
/* getting comments of posts id 1 */
fetch('https://dummyjson.com/posts/1/comments')
.then(res => res.json())
.then(console.log);
            
           
Show output

Add a new post

Adding a new post will not add it into the server.
It will simulate a POST request and will return the new created post with a new id

              
fetch('https://dummyjson.com/posts/add', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    title: 'I am in love with someone.',
    userId: 5,
    /* other post data */
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Update a post

Updating a post will not update it into the server.
It will simulate a PUT/PATCH request and will return the post with modified data

              
/* updating title of post with id 1 */
fetch('https://dummyjson.com/posts/1', {
  method: 'PUT', /* or PATCH */
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    title: 'I think I should shift to the moon',
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Delete a post

Deleting a post will not delete it into the server.
It will simulate a DELETE request and will return deleted post with "isDeleted" & "deletedOn" keys

              
fetch('https://dummyjson.com/posts/1', {
  method: 'DELETE',
})
.then(res => res.json())
.then(console.log);
            
           
Show output
Users Comments