Wrapper over FoodData Central Rest APIs for Typescript
- Acquire an API Token from FDC here. Note the rate limits.
- Expose the API Token as an Environment Variable
FDC_API_KEY
.
Right now only the Food Search API - /v1/foods/search
- is supported
const searchCriteria: FoodSearchCriteria = {
query: "milk",
dataType: [DataType.BRANDED],
pageSize: 1,
pageNumber: 1,
startDate: "2019-01-01",
endDate: "2023-01-01",
};
const searchResult: SearchResult = await findFood(searchCriteria);
This api is provided by U.S. Department of Agriculture, Agricultural Research Service. FoodData Central, 2019. fdc.nal.usda.gov.