screen size not supported

Docs

You can use examples below to check how DummyJSON works.

Todos

Get all todos

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

Get a single todo

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

Get a random todo

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

Limit and skip todos

You can pass "limit" and "skip" params to limit and skip the results for pagination.

              
fetch('https://dummyjson.com/todos?limit=3&skip=10')
.then(res => res.json())
.then(console.log);
            
           
Show output

Get all todos by user id

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

Add a new todo

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

              
fetch('https://dummyjson.com/todos/add', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    todo: 'Use DummyJSON in the project',
    completed: false,
    userId: 5,
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Update a todo

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

              
/* updating completed status of todo with id 1 */
fetch('https://dummyjson.com/todos/1', {
  method: 'PUT', /* or PATCH */
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    completed: false,
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Delete a todo

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

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