Giter Site home page Giter Site logo

nodejs-client-library's Introduction

Official Nutritionix NodeJS Client

NOTE This is still in beta and the API may change until version 1.0

NOTE v1 of the API is currently not yet implemented

Installation

npm install nutritionix --save
// Require inside your project
var nutritionix = require('nutritionix')({
    appId: 'YOUR_APP_ID',
    appKey: 'YOUR_APP_KEY'
}, false);

// Second argument false can be changed to true
// This will tell the library to enter debugging mode
// and log additional data to the console

UPC Scan

// GET https://api.nutritionix.com/v1_1/item?upc=52200004265
nutritionix.v1_1.item({
    upc: 52200004265
}, function (err, item) {
    // ...
});

Get Item by id

// GET https://api.nutritionix.com/v1_1/item?upc=52200004265
nutritionix.v1_1.item({
    id: '5284ebc52504590000003f4a'
}, function (err, item) {
    // ...
});

Get Brand By ID

// GET https://api.nutritionix.com/v1_1/brand/51db37c3176fe9790a8991f6
nutritionix.v1_1.brand({
    id: '51db37c3176fe9790a8991f6'
}, function (err, brand){
    // ...
});

Standard Search

// GET https://api.nutritionix.com/v1_1/search/mcdonalds?results=0:1
nutritionix.v1_1.search.standard({
    phrase: 'mcdonalds',
    results: '0:1'
}, function (err, results){
    // ...
});

NXQL Advanced Search

// POST https://api.nutritionix.com/v1_1/search -d DATA
nutritionix.v1_1.search.advanced({
    fields: ['item_name','brand_name'],
    query: 'mcdonalds',
    offset:0,
    limit:1
}, function (err, results){
    // ...
});

Brand Search

// GET https://api.nutritionix.com/v1_1/brand/search?query=just+salad&auto=true&type=1&min_score=1
nutritionix.v1_1.search.brand({
    query:'just salad',
    auto:true,
    type:1,
    min_score:1
}, function (err, results){
    // ...
});

Special thanks

Thank you to picsoung for allowing us to take over the npm package and inspiring us to create an official nodejs client.

nodejs-client-library's People

Contributors

sourcec0de avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.