Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spoonacular

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spoonacular

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

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by50%
Maintainers
0
Weekly downloads
 
Created
Source

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

ClassMethodHTTP requestDescription
SpoonacularApi.DefaultApianalyzeRecipePOST /recipes/analyzeAnalyze Recipe
SpoonacularApi.DefaultApicreateRecipeCardGetGET /recipes/{id}/cardCreate Recipe Card
SpoonacularApi.DefaultApisearchRestaurantsGET /food/restaurants/searchSearch Restaurants
SpoonacularApi.IngredientsApiautocompleteIngredientSearchGET /food/ingredients/autocompleteAutocomplete Ingredient Search
SpoonacularApi.IngredientsApicomputeIngredientAmountGET /food/ingredients/{id}/amountCompute Ingredient Amount
SpoonacularApi.IngredientsApigetIngredientInformationGET /food/ingredients/{id}/informationGet Ingredient Information
SpoonacularApi.IngredientsApigetIngredientSubstitutesGET /food/ingredients/substitutesGet Ingredient Substitutes
SpoonacularApi.IngredientsApigetIngredientSubstitutesByIDGET /food/ingredients/{id}/substitutesGet Ingredient Substitutes by ID
SpoonacularApi.IngredientsApiingredientSearchGET /food/ingredients/searchIngredient Search
SpoonacularApi.IngredientsApiingredientsByIDImageGET /recipes/{id}/ingredientWidget.pngIngredients by ID Image
SpoonacularApi.IngredientsApimapIngredientsToGroceryProductsPOST /food/ingredients/mapMap Ingredients to Grocery Products
SpoonacularApi.IngredientsApivisualizeIngredientsPOST /recipes/visualizeIngredientsIngredients Widget
SpoonacularApi.MealPlanningApiaddMealPlanTemplatePOST /mealplanner/{username}/templatesAdd Meal Plan Template
SpoonacularApi.MealPlanningApiaddToMealPlanPOST /mealplanner/{username}/itemsAdd to Meal Plan
SpoonacularApi.MealPlanningApiaddToShoppingListPOST /mealplanner/{username}/shopping-list/itemsAdd to Shopping List
SpoonacularApi.MealPlanningApiclearMealPlanDayDELETE /mealplanner/{username}/day/{date}Clear Meal Plan Day
SpoonacularApi.MealPlanningApiconnectUserPOST /users/connectConnect User
SpoonacularApi.MealPlanningApideleteFromMealPlanDELETE /mealplanner/{username}/items/{id}Delete from Meal Plan
SpoonacularApi.MealPlanningApideleteFromShoppingListDELETE /mealplanner/{username}/shopping-list/items/{id}Delete from Shopping List
SpoonacularApi.MealPlanningApideleteMealPlanTemplateDELETE /mealplanner/{username}/templates/{id}Delete Meal Plan Template
SpoonacularApi.MealPlanningApigenerateMealPlanGET /mealplanner/generateGenerate Meal Plan
SpoonacularApi.MealPlanningApigenerateShoppingListPOST /mealplanner/{username}/shopping-list/{start_date}/{end_date}Generate Shopping List
SpoonacularApi.MealPlanningApigetMealPlanTemplateGET /mealplanner/{username}/templates/{id}Get Meal Plan Template
SpoonacularApi.MealPlanningApigetMealPlanTemplatesGET /mealplanner/{username}/templatesGet Meal Plan Templates
SpoonacularApi.MealPlanningApigetMealPlanWeekGET /mealplanner/{username}/week/{start_date}Get Meal Plan Week
SpoonacularApi.MealPlanningApigetShoppingListGET /mealplanner/{username}/shopping-listGet Shopping List
SpoonacularApi.MenuItemsApiautocompleteMenuItemSearchGET /food/menuItems/suggestAutocomplete Menu Item Search
SpoonacularApi.MenuItemsApigetMenuItemInformationGET /food/menuItems/{id}Get Menu Item Information
SpoonacularApi.MenuItemsApimenuItemNutritionByIDImageGET /food/menuItems/{id}/nutritionWidget.pngMenu Item Nutrition by ID Image
SpoonacularApi.MenuItemsApimenuItemNutritionLabelImageGET /food/menuItems/{id}/nutritionLabel.pngMenu Item Nutrition Label Image
SpoonacularApi.MenuItemsApimenuItemNutritionLabelWidgetGET /food/menuItems/{id}/nutritionLabelMenu Item Nutrition Label Widget
SpoonacularApi.MenuItemsApisearchMenuItemsGET /food/menuItems/searchSearch Menu Items
SpoonacularApi.MenuItemsApivisualizeMenuItemNutritionByIDGET /food/menuItems/{id}/nutritionWidgetMenu Item Nutrition by ID Widget
SpoonacularApi.MiscApidetectFoodInTextPOST /food/detectDetect Food in Text
SpoonacularApi.MiscApigetARandomFoodJokeGET /food/jokes/randomRandom Food Joke
SpoonacularApi.MiscApigetConversationSuggestsGET /food/converse/suggestConversation Suggests
SpoonacularApi.MiscApigetRandomFoodTriviaGET /food/trivia/randomRandom Food Trivia
SpoonacularApi.MiscApiimageAnalysisByURLGET /food/images/analyzeImage Analysis by URL
SpoonacularApi.MiscApiimageClassificationByURLGET /food/images/classifyImage Classification by URL
SpoonacularApi.MiscApisearchAllFoodGET /food/searchSearch All Food
SpoonacularApi.MiscApisearchCustomFoodsGET /food/customFoods/searchSearch Custom Foods
SpoonacularApi.MiscApisearchFoodVideosGET /food/videos/searchSearch Food Videos
SpoonacularApi.MiscApisearchSiteContentGET /food/site/searchSearch Site Content
SpoonacularApi.MiscApitalkToChatbotGET /food/converseTalk to Chatbot
SpoonacularApi.ProductsApiautocompleteProductSearchGET /food/products/suggestAutocomplete Product Search
SpoonacularApi.ProductsApiclassifyGroceryProductPOST /food/products/classifyClassify Grocery Product
SpoonacularApi.ProductsApiclassifyGroceryProductBulkPOST /food/products/classifyBatchClassify Grocery Product Bulk
SpoonacularApi.ProductsApigetComparableProductsGET /food/products/upc/{upc}/comparableGet Comparable Products
SpoonacularApi.ProductsApigetProductInformationGET /food/products/{id}Get Product Information
SpoonacularApi.ProductsApiproductNutritionByIDImageGET /food/products/{id}/nutritionWidget.pngProduct Nutrition by ID Image
SpoonacularApi.ProductsApiproductNutritionLabelImageGET /food/products/{id}/nutritionLabel.pngProduct Nutrition Label Image
SpoonacularApi.ProductsApiproductNutritionLabelWidgetGET /food/products/{id}/nutritionLabelProduct Nutrition Label Widget
SpoonacularApi.ProductsApisearchGroceryProductsGET /food/products/searchSearch Grocery Products
SpoonacularApi.ProductsApisearchGroceryProductsByUPCGET /food/products/upc/{upc}Search Grocery Products by UPC
SpoonacularApi.ProductsApivisualizeProductNutritionByIDGET /food/products/{id}/nutritionWidgetProduct Nutrition by ID Widget
SpoonacularApi.RecipesApianalyzeARecipeSearchQueryGET /recipes/queries/analyzeAnalyze a Recipe Search Query
SpoonacularApi.RecipesApianalyzeRecipeInstructionsPOST /recipes/analyzeInstructionsAnalyze Recipe Instructions
SpoonacularApi.RecipesApiautocompleteRecipeSearchGET /recipes/autocompleteAutocomplete Recipe Search
SpoonacularApi.RecipesApiclassifyCuisinePOST /recipes/cuisineClassify Cuisine
SpoonacularApi.RecipesApicomputeGlycemicLoadPOST /food/ingredients/glycemicLoadCompute Glycemic Load
SpoonacularApi.RecipesApiconvertAmountsGET /recipes/convertConvert Amounts
SpoonacularApi.RecipesApicreateRecipeCardPOST /recipes/visualizeRecipeCreate Recipe Card
SpoonacularApi.RecipesApiequipmentByIDImageGET /recipes/{id}/equipmentWidget.pngEquipment by ID Image
SpoonacularApi.RecipesApiextractRecipeFromWebsiteGET /recipes/extractExtract Recipe from Website
SpoonacularApi.RecipesApigetAnalyzedRecipeInstructionsGET /recipes/{id}/analyzedInstructionsGet Analyzed Recipe Instructions
SpoonacularApi.RecipesApigetRandomRecipesGET /recipes/randomGet Random Recipes
SpoonacularApi.RecipesApigetRecipeEquipmentByIDGET /recipes/{id}/equipmentWidget.jsonEquipment by ID
SpoonacularApi.RecipesApigetRecipeInformationGET /recipes/{id}/informationGet Recipe Information
SpoonacularApi.RecipesApigetRecipeInformationBulkGET /recipes/informationBulkGet Recipe Information Bulk
SpoonacularApi.RecipesApigetRecipeIngredientsByIDGET /recipes/{id}/ingredientWidget.jsonIngredients by ID
SpoonacularApi.RecipesApigetRecipeNutritionWidgetByIDGET /recipes/{id}/nutritionWidget.jsonNutrition by ID
SpoonacularApi.RecipesApigetRecipePriceBreakdownByIDGET /recipes/{id}/priceBreakdownWidget.jsonPrice Breakdown by ID
SpoonacularApi.RecipesApigetRecipeTasteByIDGET /recipes/{id}/tasteWidget.jsonTaste by ID
SpoonacularApi.RecipesApigetSimilarRecipesGET /recipes/{id}/similarGet Similar Recipes
SpoonacularApi.RecipesApiguessNutritionByDishNameGET /recipes/guessNutritionGuess Nutrition by Dish Name
SpoonacularApi.RecipesApiparseIngredientsPOST /recipes/parseIngredientsParse Ingredients
SpoonacularApi.RecipesApipriceBreakdownByIDImageGET /recipes/{id}/priceBreakdownWidget.pngPrice Breakdown by ID Image
SpoonacularApi.RecipesApiquickAnswerGET /recipes/quickAnswerQuick Answer
SpoonacularApi.RecipesApirecipeNutritionByIDImageGET /recipes/{id}/nutritionWidget.pngRecipe Nutrition by ID Image
SpoonacularApi.RecipesApirecipeNutritionLabelImageGET /recipes/{id}/nutritionLabel.pngRecipe Nutrition Label Image
SpoonacularApi.RecipesApirecipeNutritionLabelWidgetGET /recipes/{id}/nutritionLabelRecipe Nutrition Label Widget
SpoonacularApi.RecipesApirecipeTasteByIDImageGET /recipes/{id}/tasteWidget.pngRecipe Taste by ID Image
SpoonacularApi.RecipesApisearchRecipesGET /recipes/complexSearchSearch Recipes
SpoonacularApi.RecipesApisearchRecipesByIngredientsGET /recipes/findByIngredientsSearch Recipes by Ingredients
SpoonacularApi.RecipesApisearchRecipesByNutrientsGET /recipes/findByNutrientsSearch Recipes by Nutrients
SpoonacularApi.RecipesApisummarizeRecipeGET /recipes/{id}/summarySummarize Recipe
SpoonacularApi.RecipesApivisualizeEquipmentPOST /recipes/visualizeEquipmentEquipment Widget
SpoonacularApi.RecipesApivisualizePriceBreakdownPOST /recipes/visualizePriceEstimatorPrice Breakdown Widget
SpoonacularApi.RecipesApivisualizeRecipeEquipmentByIDGET /recipes/{id}/equipmentWidgetEquipment by ID Widget
SpoonacularApi.RecipesApivisualizeRecipeIngredientsByIDGET /recipes/{id}/ingredientWidgetIngredients by ID Widget
SpoonacularApi.RecipesApivisualizeRecipeNutritionPOST /recipes/visualizeNutritionRecipe Nutrition Widget
SpoonacularApi.RecipesApivisualizeRecipeNutritionByIDGET /recipes/{id}/nutritionWidgetRecipe Nutrition by ID Widget
SpoonacularApi.RecipesApivisualizeRecipePriceBreakdownByIDGET /recipes/{id}/priceBreakdownWidgetPrice Breakdown by ID Widget
SpoonacularApi.RecipesApivisualizeRecipeTastePOST /recipes/visualizeTasteRecipe Taste Widget
SpoonacularApi.RecipesApivisualizeRecipeTasteByIDGET /recipes/{id}/tasteWidgetRecipe Taste by ID Widget
SpoonacularApi.WineApigetDishPairingForWineGET /food/wine/dishesDish Pairing for Wine
SpoonacularApi.WineApigetWineDescriptionGET /food/wine/descriptionWine Description
SpoonacularApi.WineApigetWinePairingGET /food/wine/pairingWine Pairing
SpoonacularApi.WineApigetWineRecommendationGET /food/wine/recommendationWine 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

Keywords

FAQs

Package last updated on 18 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc