screen size not supported

Docs

You can use examples below to check how DummyJSON works.

Carts

Get all carts

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

Get a single cart

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

Get carts of a user

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

Add a new cart

Adding a new cart will not add it into the server.
It will simulate a POST request and will return the new created cart with a new id
You can provide a userId and array of products as objects, containing productId & quantity

              
fetch('https://dummyjson.com/carts/add', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    userId: 1,
    products: [
      {
        id: 1,
        quantity: 1,
      },
      {
        id: 50,
        quantity: 2,
      },
    ]
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Update a cart

Updating a cart will not update it into the server.
It will simulate a PUT/PATCH request and will return updated cart with modified data
You can provide a userId and array of products as objects, containing productId & quantity

              
/* adding products in cart with id 1 */
fetch('https://dummyjson.com/carts/1', {
  method: 'PUT', /* or PATCH */
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    products: [
      {
        id: 1,
        quantity: 1,
      },
    ]
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Delete a cart

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

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