Sign in | Sign up

Exercise

Tagged:

Currently contains 1 post

Avatar

May 06, 2020 11:26

Sven

When calling the fetch method I get error child “query” fails because [“query” is required].I really don’t see what I’m doing wrong.I saw this problem in this forum I tried these steps myself but it still doesn’t work. I appreciate any help.
This is my code

let post = {
method: “POST”,
headers: {
“x-app-id”:“private”,
“Content-Type”: “application/json”,
“x-remote-user-id”:“0”,
“x-app-key”:“private”,
},
body: {
“query”:“ran 3 miles”,
“gender”:“female”,
weight_kg,
height_cm,
age
}
}

await fetch(“https://trackapi.nutritionix.com/v2/natural/exercise”,post) .then((respone)=>respone.json()) .then((responeJson)=>{console.log(responeJson)}) .catch((error)=>console.log(error))
Reply to thread