npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spoonacular

v2.0.1

Published

The spoonacular Nutrition, Recipe, and Food API allows you to access over thousands of recipes, thousands of ingredients, 800,000 food products, over 100,000 menu items, and restaurants. Our food ontology and semantic recipe search engine makes it possibl

Downloads

195

Readme

spoonacular-api

SpoonacularApi - JavaScript client for spoonacular-api The spoonacular Nutrition, Recipe, and Food API allows you to access over thousands of recipes, thousands of ingredients, 800,000 food products, over 100,000 menu items, and restaurants. Our food ontology and semantic recipe search engine makes it possible to search for recipes using natural language queries, such as "gluten free brownies without sugar" or "low fat vegan cupcakes." You can automatically calculate the nutritional information for any recipe, analyze recipe costs, visualize ingredient lists, find recipes for what's in your fridge, find recipes based on special diets, nutritional requirements, or favorite ingredients, classify recipes into types and cuisines, convert ingredient amounts, or even compute an entire meal plan. With our powerful API, you can create many kinds of food and especially nutrition apps.

Special diets/dietary requirements currently available include: vegan, vegetarian, pescetarian, gluten free, grain free, dairy free, high protein, whole 30, low sodium, low carb, Paleo, ketogenic, FODMAP, and Primal. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.1
  • Package version: 2.0.1
  • Generator version: 7.8.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://spoonacular.com/contact

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install spoonacular-api --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your spoonacular-api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/ddsky/spoonacular-api-clients/tree/master/javascript/ then install it via:

    npm install ddsky/spoonacular-api-clients/tree/master/javascript/ --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var SpoonacularApi = require('spoonacular-api');

var defaultClient = SpoonacularApi.ApiClient.instance;
// Configure API key authorization: apiKeyScheme
var apiKeyScheme = defaultClient.authentications['apiKeyScheme'];
apiKeyScheme.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKeyScheme.apiKeyPrefix['x-api-key'] = "Token"

var api = new SpoonacularApi.DefaultApi()
var analyzeRecipeRequest = {"title":"Spaghetti Carbonara","servings":2,"ingredients":["1 lb spaghetti","3.5 oz pancetta","2 Tbsps olive oil","1  egg","0.5 cup parmesan cheese"],"instructions":"Bring a large pot of water to a boil and season generously with salt. Add the pasta to the water once boiling and cook until al dente. Reserve 2 cups of cooking water and drain the pasta. "}; // {AnalyzeRecipeRequest} Example request body.
var opts = {
  'language': "en", // {String} The input language, either \"en\" or \"de\".
  'includeNutrition': false, // {Boolean} Whether nutrition data should be added to correctly parsed ingredients.
  'includeTaste': false // {Boolean} Whether taste data should be added to correctly parsed ingredients.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.analyzeRecipe(analyzeRecipeRequest, opts, callback);

Documentation for API Endpoints

All URIs are relative to https://api.spoonacular.com

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- SpoonacularApi.DefaultApi | analyzeRecipe | POST /recipes/analyze | Analyze Recipe SpoonacularApi.DefaultApi | createRecipeCardGet | GET /recipes/{id}/card | Create Recipe Card SpoonacularApi.DefaultApi | searchRestaurants | GET /food/restaurants/search | Search Restaurants SpoonacularApi.IngredientsApi | autocompleteIngredientSearch | GET /food/ingredients/autocomplete | Autocomplete Ingredient Search SpoonacularApi.IngredientsApi | computeIngredientAmount | GET /food/ingredients/{id}/amount | Compute Ingredient Amount SpoonacularApi.IngredientsApi | getIngredientInformation | GET /food/ingredients/{id}/information | Get Ingredient Information SpoonacularApi.IngredientsApi | getIngredientSubstitutes | GET /food/ingredients/substitutes | Get Ingredient Substitutes SpoonacularApi.IngredientsApi | getIngredientSubstitutesByID | GET /food/ingredients/{id}/substitutes | Get Ingredient Substitutes by ID SpoonacularApi.IngredientsApi | ingredientSearch | GET /food/ingredients/search | Ingredient Search SpoonacularApi.IngredientsApi | ingredientsByIDImage | GET /recipes/{id}/ingredientWidget.png | Ingredients by ID Image SpoonacularApi.IngredientsApi | mapIngredientsToGroceryProducts | POST /food/ingredients/map | Map Ingredients to Grocery Products SpoonacularApi.IngredientsApi | visualizeIngredients | POST /recipes/visualizeIngredients | Ingredients Widget SpoonacularApi.MealPlanningApi | addMealPlanTemplate | POST /mealplanner/{username}/templates | Add Meal Plan Template SpoonacularApi.MealPlanningApi | addToMealPlan | POST /mealplanner/{username}/items | Add to Meal Plan SpoonacularApi.MealPlanningApi | addToShoppingList | POST /mealplanner/{username}/shopping-list/items | Add to Shopping List SpoonacularApi.MealPlanningApi | clearMealPlanDay | DELETE /mealplanner/{username}/day/{date} | Clear Meal Plan Day SpoonacularApi.MealPlanningApi | connectUser | POST /users/connect | Connect User SpoonacularApi.MealPlanningApi | deleteFromMealPlan | DELETE /mealplanner/{username}/items/{id} | Delete from Meal Plan SpoonacularApi.MealPlanningApi | deleteFromShoppingList | DELETE /mealplanner/{username}/shopping-list/items/{id} | Delete from Shopping List SpoonacularApi.MealPlanningApi | deleteMealPlanTemplate | DELETE /mealplanner/{username}/templates/{id} | Delete Meal Plan Template SpoonacularApi.MealPlanningApi | generateMealPlan | GET /mealplanner/generate | Generate Meal Plan SpoonacularApi.MealPlanningApi | generateShoppingList | POST /mealplanner/{username}/shopping-list/{start_date}/{end_date} | Generate Shopping List SpoonacularApi.MealPlanningApi | getMealPlanTemplate | GET /mealplanner/{username}/templates/{id} | Get Meal Plan Template SpoonacularApi.MealPlanningApi | getMealPlanTemplates | GET /mealplanner/{username}/templates | Get Meal Plan Templates SpoonacularApi.MealPlanningApi | getMealPlanWeek | GET /mealplanner/{username}/week/{start_date} | Get Meal Plan Week SpoonacularApi.MealPlanningApi | getShoppingList | GET /mealplanner/{username}/shopping-list | Get Shopping List SpoonacularApi.MenuItemsApi | autocompleteMenuItemSearch | GET /food/menuItems/suggest | Autocomplete Menu Item Search SpoonacularApi.MenuItemsApi | getMenuItemInformation | GET /food/menuItems/{id} | Get Menu Item Information SpoonacularApi.MenuItemsApi | menuItemNutritionByIDImage | GET /food/menuItems/{id}/nutritionWidget.png | Menu Item Nutrition by ID Image SpoonacularApi.MenuItemsApi | menuItemNutritionLabelImage | GET /food/menuItems/{id}/nutritionLabel.png | Menu Item Nutrition Label Image SpoonacularApi.MenuItemsApi | menuItemNutritionLabelWidget | GET /food/menuItems/{id}/nutritionLabel | Menu Item Nutrition Label Widget SpoonacularApi.MenuItemsApi | searchMenuItems | GET /food/menuItems/search | Search Menu Items SpoonacularApi.MenuItemsApi | visualizeMenuItemNutritionByID | GET /food/menuItems/{id}/nutritionWidget | Menu Item Nutrition by ID Widget SpoonacularApi.MiscApi | detectFoodInText | POST /food/detect | Detect Food in Text SpoonacularApi.MiscApi | getARandomFoodJoke | GET /food/jokes/random | Random Food Joke SpoonacularApi.MiscApi | getConversationSuggests | GET /food/converse/suggest | Conversation Suggests SpoonacularApi.MiscApi | getRandomFoodTrivia | GET /food/trivia/random | Random Food Trivia SpoonacularApi.MiscApi | imageAnalysisByURL | GET /food/images/analyze | Image Analysis by URL SpoonacularApi.MiscApi | imageClassificationByURL | GET /food/images/classify | Image Classification by URL SpoonacularApi.MiscApi | searchAllFood | GET /food/search | Search All Food SpoonacularApi.MiscApi | searchCustomFoods | GET /food/customFoods/search | Search Custom Foods SpoonacularApi.MiscApi | searchFoodVideos | GET /food/videos/search | Search Food Videos SpoonacularApi.MiscApi | searchSiteContent | GET /food/site/search | Search Site Content SpoonacularApi.MiscApi | talkToChatbot | GET /food/converse | Talk to Chatbot SpoonacularApi.ProductsApi | autocompleteProductSearch | GET /food/products/suggest | Autocomplete Product Search SpoonacularApi.ProductsApi | classifyGroceryProduct | POST /food/products/classify | Classify Grocery Product SpoonacularApi.ProductsApi | classifyGroceryProductBulk | POST /food/products/classifyBatch | Classify Grocery Product Bulk SpoonacularApi.ProductsApi | getComparableProducts | GET /food/products/upc/{upc}/comparable | Get Comparable Products SpoonacularApi.ProductsApi | getProductInformation | GET /food/products/{id} | Get Product Information SpoonacularApi.ProductsApi | productNutritionByIDImage | GET /food/products/{id}/nutritionWidget.png | Product Nutrition by ID Image SpoonacularApi.ProductsApi | productNutritionLabelImage | GET /food/products/{id}/nutritionLabel.png | Product Nutrition Label Image SpoonacularApi.ProductsApi | productNutritionLabelWidget | GET /food/products/{id}/nutritionLabel | Product Nutrition Label Widget SpoonacularApi.ProductsApi | searchGroceryProducts | GET /food/products/search | Search Grocery Products SpoonacularApi.ProductsApi | searchGroceryProductsByUPC | GET /food/products/upc/{upc} | Search Grocery Products by UPC SpoonacularApi.ProductsApi | visualizeProductNutritionByID | GET /food/products/{id}/nutritionWidget | Product Nutrition by ID Widget SpoonacularApi.RecipesApi | analyzeARecipeSearchQuery | GET /recipes/queries/analyze | Analyze a Recipe Search Query SpoonacularApi.RecipesApi | analyzeRecipeInstructions | POST /recipes/analyzeInstructions | Analyze Recipe Instructions SpoonacularApi.RecipesApi | autocompleteRecipeSearch | GET /recipes/autocomplete | Autocomplete Recipe Search SpoonacularApi.RecipesApi | classifyCuisine | POST /recipes/cuisine | Classify Cuisine SpoonacularApi.RecipesApi | computeGlycemicLoad | POST /food/ingredients/glycemicLoad | Compute Glycemic Load SpoonacularApi.RecipesApi | convertAmounts | GET /recipes/convert | Convert Amounts SpoonacularApi.RecipesApi | createRecipeCard | POST /recipes/visualizeRecipe | Create Recipe Card SpoonacularApi.RecipesApi | equipmentByIDImage | GET /recipes/{id}/equipmentWidget.png | Equipment by ID Image SpoonacularApi.RecipesApi | extractRecipeFromWebsite | GET /recipes/extract | Extract Recipe from Website SpoonacularApi.RecipesApi | getAnalyzedRecipeInstructions | GET /recipes/{id}/analyzedInstructions | Get Analyzed Recipe Instructions SpoonacularApi.RecipesApi | getRandomRecipes | GET /recipes/random | Get Random Recipes SpoonacularApi.RecipesApi | getRecipeEquipmentByID | GET /recipes/{id}/equipmentWidget.json | Equipment by ID SpoonacularApi.RecipesApi | getRecipeInformation | GET /recipes/{id}/information | Get Recipe Information SpoonacularApi.RecipesApi | getRecipeInformationBulk | GET /recipes/informationBulk | Get Recipe Information Bulk SpoonacularApi.RecipesApi | getRecipeIngredientsByID | GET /recipes/{id}/ingredientWidget.json | Ingredients by ID SpoonacularApi.RecipesApi | getRecipeNutritionWidgetByID | GET /recipes/{id}/nutritionWidget.json | Nutrition by ID SpoonacularApi.RecipesApi | getRecipePriceBreakdownByID | GET /recipes/{id}/priceBreakdownWidget.json | Price Breakdown by ID SpoonacularApi.RecipesApi | getRecipeTasteByID | GET /recipes/{id}/tasteWidget.json | Taste by ID SpoonacularApi.RecipesApi | getSimilarRecipes | GET /recipes/{id}/similar | Get Similar Recipes SpoonacularApi.RecipesApi | guessNutritionByDishName | GET /recipes/guessNutrition | Guess Nutrition by Dish Name SpoonacularApi.RecipesApi | parseIngredients | POST /recipes/parseIngredients | Parse Ingredients SpoonacularApi.RecipesApi | priceBreakdownByIDImage | GET /recipes/{id}/priceBreakdownWidget.png | Price Breakdown by ID Image SpoonacularApi.RecipesApi | quickAnswer | GET /recipes/quickAnswer | Quick Answer SpoonacularApi.RecipesApi | recipeNutritionByIDImage | GET /recipes/{id}/nutritionWidget.png | Recipe Nutrition by ID Image SpoonacularApi.RecipesApi | recipeNutritionLabelImage | GET /recipes/{id}/nutritionLabel.png | Recipe Nutrition Label Image SpoonacularApi.RecipesApi | recipeNutritionLabelWidget | GET /recipes/{id}/nutritionLabel | Recipe Nutrition Label Widget SpoonacularApi.RecipesApi | recipeTasteByIDImage | GET /recipes/{id}/tasteWidget.png | Recipe Taste by ID Image SpoonacularApi.RecipesApi | searchRecipes | GET /recipes/complexSearch | Search Recipes SpoonacularApi.RecipesApi | searchRecipesByIngredients | GET /recipes/findByIngredients | Search Recipes by Ingredients SpoonacularApi.RecipesApi | searchRecipesByNutrients | GET /recipes/findByNutrients | Search Recipes by Nutrients SpoonacularApi.RecipesApi | summarizeRecipe | GET /recipes/{id}/summary | Summarize Recipe SpoonacularApi.RecipesApi | visualizeEquipment | POST /recipes/visualizeEquipment | Equipment Widget SpoonacularApi.RecipesApi | visualizePriceBreakdown | POST /recipes/visualizePriceEstimator | Price Breakdown Widget SpoonacularApi.RecipesApi | visualizeRecipeEquipmentByID | GET /recipes/{id}/equipmentWidget | Equipment by ID Widget SpoonacularApi.RecipesApi | visualizeRecipeIngredientsByID | GET /recipes/{id}/ingredientWidget | Ingredients by ID Widget SpoonacularApi.RecipesApi | visualizeRecipeNutrition | POST /recipes/visualizeNutrition | Recipe Nutrition Widget SpoonacularApi.RecipesApi | visualizeRecipeNutritionByID | GET /recipes/{id}/nutritionWidget | Recipe Nutrition by ID Widget SpoonacularApi.RecipesApi | visualizeRecipePriceBreakdownByID | GET /recipes/{id}/priceBreakdownWidget | Price Breakdown by ID Widget SpoonacularApi.RecipesApi | visualizeRecipeTaste | POST /recipes/visualizeTaste | Recipe Taste Widget SpoonacularApi.RecipesApi | visualizeRecipeTasteByID | GET /recipes/{id}/tasteWidget | Recipe Taste by ID Widget SpoonacularApi.WineApi | getDishPairingForWine | GET /food/wine/dishes | Dish Pairing for Wine SpoonacularApi.WineApi | getWineDescription | GET /food/wine/description | Wine Description SpoonacularApi.WineApi | getWinePairing | GET /food/wine/pairing | Wine Pairing SpoonacularApi.WineApi | getWineRecommendation | GET /food/wine/recommendation | Wine Recommendation

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

apiKeyScheme

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header