Documentation
You can copy paste the code in your browser console to quickly test Store API.
Product
Get All Products
fetch('https://api.storerestapi.com/products')
.then(response => response.json())
.then(json => console.log(json))
Get Single Product
fetch('https://api.storerestapi.com/products/running-sneaker')
.then(response => response.json())
.then(json => console.log(json))
Pagination Results
fetch('https://api.storerestapi.com/products?limit=10&page=1')
.then(response => response.json())
.then(json => console.log(json))
Create Product
fetch('https://api.storerestapi.com/products',
{
method: 'POST',
body: JSON.stringify({
title: 'Men Boxer Sneakers For Men (Black)',
price: 799,
description: 'Lorem Ipsum is simply dummy text of the printing',
category: "612e42d755b07f20de9ec6a5"
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then(response => response.json())
.then(json => console.log(json))
Update Product
fetch('https://api.storerestapi.com/products/running-sneaker',
{
method: 'PUT',
body: JSON.stringify({
title: 'Men Boxer Sneakers For Men (Black)',
price: 799,
description: 'Lorem Ipsum is simply dummy text of the printing',
category: "612e42d755b07f20de9ec6a5"
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then(response => response.json())
.then(json => console.log(json))
Delete Product
fetch('https://api.storerestapi.com/products/running-sneaker',
{
method: 'DELETE',
})
.then(response => response.json())
.then(json => console.log(json))