Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshterrill/usda-ingredients-api
a private REST API used for pulling ingredients given a UPC code from ndb.nal.usda.gov
https://github.com/joshterrill/usda-ingredients-api
Last synced: 3 months ago
JSON representation
a private REST API used for pulling ingredients given a UPC code from ndb.nal.usda.gov
- Host: GitHub
- URL: https://github.com/joshterrill/usda-ingredients-api
- Owner: joshterrill
- Created: 2018-07-23T07:58:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T21:34:14.000Z (almost 2 years ago)
- Last Synced: 2024-07-22T19:19:18.353Z (4 months ago)
- Language: JavaScript
- Size: 93.8 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# USDA Ingredients API
A library that makes REST requests against the USDA API to pull ingredients for food products.
## Installation
```bash
# through npm
npm i usda-ingredients-api --save
```## Example Usage
```javascript
const usda = require("usda-ingredients-api");const results = await usda("815893000163");
console.log(results);
/*
[
{
"fdcId": 383682,
"description": "A.A. BORSARI, PEPPER SEASONING PEPPERCORN",
"lowercaseDescription": "a.a. borsari, pepper seasoning peppercorn",
"dataType": "Branded",
"gtinUpc": "815893000163",
"publishedDate": "2019-04-01",
"brandOwner": "Valley Brook Farm",
"ingredients": "CRACKED BLACK PEPPER, GARLIC, SEA SALT, SPICES.",
"foodNutrients": [
{
"nutrientId": 1004,
"nutrientName": "Total lipid (fat)",
"nutrientNumber": "204",
"unitName": "G",
"derivationCode": "LCCD",
"derivationDescription": "Calculated from a daily value percentage per serving size measure",
"value": 0
},
{
"nutrientId": 1005,
"nutrientName": "Carbohydrate, by difference",
"nutrientNumber": "205",
"unitName": "G",
"derivationCode": "LCCD",
"derivationDescription": "Calculated from a daily value percentage per serving size measure",
"value": 0
},
{
"nutrientId": 1003,
"nutrientName": "Protein",
"nutrientNumber": "203",
"unitName": "G",
"derivationCode": "LCCS",
"derivationDescription": "Calculated from value per serving size measure",
"value": 0
},
{
"nutrientId": 1008,
"nutrientName": "Energy",
"nutrientNumber": "208",
"unitName": "KCAL",
"derivationCode": "LCCS",
"derivationDescription": "Calculated from value per serving size measure",
"value": 0
},
{
"nutrientId": 1093,
"nutrientName": "Sodium, Na",
"nutrientNumber": "307",
"unitName": "MG",
"derivationCode": "LCCS",
"derivationDescription": "Calculated from value per serving size measure",
"value": 10556
}
],
"allHighlightFields": "GTIN/UPC: 815893000163",
"score": -651.1118
}
]
*/
```