screen size not supported

Docs

You can use examples below to check how DummyJSON works.

Comments

Get all comments

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

Get a single comment

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

Limit and skip comments

You can pass "limit" and "skip" params to limit and skip the results for pagination.
You can pass "select" as query params with comma-separated values to select specific data.

              
fetch('https://dummyjson.com/comments?limit=10&skip=10&select=body,postId')
.then(res => res.json())
.then(console.log);
            
           
Show output

Get all comments by post id

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

Add a new comment

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

              
fetch('https://dummyjson.com/comments/add', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    body: 'This makes all sense to me!',
    postId: 3,
    userId: 5,
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Update a comment

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

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

Delete a comment

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

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