Documentation
You can copy paste the code in your browser console to quickly test Store API.
Product
Get all products
fetch('STORE_CLIENT_API_BASE_URL/products')
.then(response => response.json())
.then(json => console.log(json))
Get single product
fetch('STORE_CLIENT_API_BASE_URL/products/running-sneaker')
.then(response => response.json())
.then(json => console.log(json))
Pagination results
fetch('STORE_CLIENT_API_BASE_URL/products?limit=10&page=1')
.then(response => response.json())
.then(json => console.log(json))
Create product
fetch('STORE_CLIENT_API_BASE_URL/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('STORE_CLIENT_API_BASE_URL/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('STORE_CLIENT_API_BASE_URL/products/running-sneaker',
{
method: 'DELETE',
})
.then(response => response.json())
.then(json => console.log(json))