Open surfmuggle opened 3 years ago
added hint about fruit shop api and new label
To call a webservice from the browser fetch can be used.
function loadData()
{
const productURL = "https://api.predic8.de/shop/products/";
fetch(productURL)
.then(response => response.json())
.then(data => listProducts(data));
}
function listProducts(data)
{
console.log(data.products);
data.products.forEach(product => {
console.log(product.name);
});
}
I am having trouble posting / adding a new product . Therefore i recommend that you start with listing the products (see attached screen).
There are website that offer public web services
Fruit shop api