-
Notifications
You must be signed in to change notification settings - Fork 0
API_Usage
The FDC API stores relevant caloric, macro-nutrient and descriptive data about all foods in their database. Through a GET or POST call including relevant data, one can obtain data about almost all foods currently sold today. The most accurate way to get relevant data would be to sent a GET request with the FDC ID of the food in question, but with only a barcode string then a POST request with a query object is the most realistic utilization of this service.
curl https://api.nal.usda.gov/fdc/v1/food/######?api_key=DEMO_KEY
(######) to be replaced with the FDC ID of the food in question
curl -XPOST -H "Content-Type:application/json" -d '{"query":"BARCODE HERE"}' https://api.nal.usda.gov/fdc/v1/foods/search?api_key=DEMO_KEY
(BARCODE HERE) to be replaced with the barcode string of the food in question