kjenkins5678 / fitness-app

3 stars 0 forks source link

As a fitness website user, I want to get the searched information from the nutrition api and use that information to update the ui #16

Open kjenkins5678 opened 4 years ago

kjenkins5678 commented 4 years ago

Nutritionix API docs: https://docs.google.com/document/d/1_q-K-ObMTZvO0qUEAxROrN3bwMujwAN25sLHwJzliK0/edit#

Nutritionix Example Request: https://gist.github.com/mattsilv/9dfb709e7609537ffd3b1b8c097e9bfb

Figuring out how to use postman app: https://learning.getpostman.com/docs/postman/sending-api-requests/requests/

Code from postman request:

var settings = {
  "url": "https://trackapi.nutritionix.com/v2/natural/nutrients",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "x-app-id": "045860e3",
    "x-app-key": "c32b88786979d5b33948d3010f469a5a",
    "x-remote-user-id": "0",
    "content-type": "application/json"
  },
  "data": JSON.stringify({"query":"banana","timezone":"US/Eastern"}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});