oanguin / toxicity-checker

This is a mobile application which is used to check the toxicity of a product including if the product has any carcinogenic substances. toxic or carc
0 stars 0 forks source link

Find API for checking Toxicity and Carcinogenic Details based on ingredients #7

Closed oanguin closed 2 years ago

oanguin commented 2 years ago

Can use nutritionix API to get ingredient facts. This can be used to generate a page of ingredient details.

var myHeaders = new Headers();
myHeaders.append("x-app-id", "27c34f98");
myHeaders.append("x-app-key", "eb9f49bcb5a1bd63a9fe2f5402989664");
myHeaders.append("x-remote-user-id", "0");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "query": "water"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://trackapi.nutritionix.com/v2/natural/nutrients", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));