Nutritionix - Nutrition Database

FREE
By msilverman
Updated 17 days ago
Food
8.8/10
Popularity Score
303ms
Latency
96%
Success Rate
vongdarakia2 years ago
Undefined BodyNo matter what I search, I get an undefined body. This is what I ran on NodeJS. unirest.get("https://nutritionix-api.p.mashape.com/v1_1/search/pizza?fields=item_name%2Citem_id%2Cbrand_name%2Cnf_calories%2Cnf_total_fat") .header("X-Mashape-Key", "wbyCsc5ChWmshvo4hUgvEMlE4Ro1p194zHsjsn3FiEwT7LIKgV") .header("Accept", "application/json") .end(function (result) { console.log(result.status, result.headers, result.body); });
Hi Developer, feel free to post your answer:

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.get("https://nutritionix-api.p.rapidapi.com/v1_1/search/cheddar%20cheese?fields=item_name%2Citem_id%2Cbrand_name%2Cnf_calories%2Cnf_total_fat")
.header("X-RapidAPI-Host", "nutritionix-api.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication