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 API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 2.0.1
- Package version: 2.0.1
- Generator version: 7.8.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://spoonacular.com/contact
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import spoonacular "github.com/ddsky/spoonacular-api-clients/go"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value spoonacular.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), spoonacular.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value spoonacular.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), spoonacular.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using spoonacular.ContextOperationServerIndices
and spoonacular.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), spoonacular.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), spoonacular.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
All URIs are relative to https://api.spoonacular.com
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultAPI | AnalyzeRecipe | Post /recipes/analyze | Analyze Recipe |
DefaultAPI | CreateRecipeCardGet | Get /recipes/{id}/card | Create Recipe Card |
DefaultAPI | SearchRestaurants | Get /food/restaurants/search | Search Restaurants |
IngredientsAPI | AutocompleteIngredientSearch | Get /food/ingredients/autocomplete | Autocomplete Ingredient Search |
IngredientsAPI | ComputeIngredientAmount | Get /food/ingredients/{id}/amount | Compute Ingredient Amount |
IngredientsAPI | GetIngredientInformation | Get /food/ingredients/{id}/information | Get Ingredient Information |
IngredientsAPI | GetIngredientSubstitutes | Get /food/ingredients/substitutes | Get Ingredient Substitutes |
IngredientsAPI | GetIngredientSubstitutesByID | Get /food/ingredients/{id}/substitutes | Get Ingredient Substitutes by ID |
IngredientsAPI | IngredientSearch | Get /food/ingredients/search | Ingredient Search |
IngredientsAPI | IngredientsByIDImage | Get /recipes/{id}/ingredientWidget.png | Ingredients by ID Image |
IngredientsAPI | MapIngredientsToGroceryProducts | Post /food/ingredients/map | Map Ingredients to Grocery Products |
IngredientsAPI | VisualizeIngredients | Post /recipes/visualizeIngredients | Ingredients Widget |
MealPlanningAPI | AddMealPlanTemplate | Post /mealplanner/{username}/templates | Add Meal Plan Template |
MealPlanningAPI | AddToMealPlan | Post /mealplanner/{username}/items | Add to Meal Plan |
MealPlanningAPI | AddToShoppingList | Post /mealplanner/{username}/shopping-list/items | Add to Shopping List |
MealPlanningAPI | ClearMealPlanDay | Delete /mealplanner/{username}/day/{date} | Clear Meal Plan Day |
MealPlanningAPI | ConnectUser | Post /users/connect | Connect User |
MealPlanningAPI | DeleteFromMealPlan | Delete /mealplanner/{username}/items/{id} | Delete from Meal Plan |
MealPlanningAPI | DeleteFromShoppingList | Delete /mealplanner/{username}/shopping-list/items/{id} | Delete from Shopping List |
MealPlanningAPI | DeleteMealPlanTemplate | Delete /mealplanner/{username}/templates/{id} | Delete Meal Plan Template |
MealPlanningAPI | GenerateMealPlan | Get /mealplanner/generate | Generate Meal Plan |
MealPlanningAPI | GenerateShoppingList | Post /mealplanner/{username}/shopping-list/{start_date}/{end_date} | Generate Shopping List |
MealPlanningAPI | GetMealPlanTemplate | Get /mealplanner/{username}/templates/{id} | Get Meal Plan Template |
MealPlanningAPI | GetMealPlanTemplates | Get /mealplanner/{username}/templates | Get Meal Plan Templates |
MealPlanningAPI | GetMealPlanWeek | Get /mealplanner/{username}/week/{start_date} | Get Meal Plan Week |
MealPlanningAPI | GetShoppingList | Get /mealplanner/{username}/shopping-list | Get Shopping List |
MenuItemsAPI | AutocompleteMenuItemSearch | Get /food/menuItems/suggest | Autocomplete Menu Item Search |
MenuItemsAPI | GetMenuItemInformation | Get /food/menuItems/{id} | Get Menu Item Information |
MenuItemsAPI | MenuItemNutritionByIDImage | Get /food/menuItems/{id}/nutritionWidget.png | Menu Item Nutrition by ID Image |
MenuItemsAPI | MenuItemNutritionLabelImage | Get /food/menuItems/{id}/nutritionLabel.png | Menu Item Nutrition Label Image |
MenuItemsAPI | MenuItemNutritionLabelWidget | Get /food/menuItems/{id}/nutritionLabel | Menu Item Nutrition Label Widget |
MenuItemsAPI | SearchMenuItems | Get /food/menuItems/search | Search Menu Items |
MenuItemsAPI | VisualizeMenuItemNutritionByID | Get /food/menuItems/{id}/nutritionWidget | Menu Item Nutrition by ID Widget |
MiscAPI | DetectFoodInText | Post /food/detect | Detect Food in Text |
MiscAPI | GetARandomFoodJoke | Get /food/jokes/random | Random Food Joke |
MiscAPI | GetConversationSuggests | Get /food/converse/suggest | Conversation Suggests |
MiscAPI | GetRandomFoodTrivia | Get /food/trivia/random | Random Food Trivia |
MiscAPI | ImageAnalysisByURL | Get /food/images/analyze | Image Analysis by URL |
MiscAPI | ImageClassificationByURL | Get /food/images/classify | Image Classification by URL |
MiscAPI | SearchAllFood | Get /food/search | Search All Food |
MiscAPI | SearchCustomFoods | Get /food/customFoods/search | Search Custom Foods |
MiscAPI | SearchFoodVideos | Get /food/videos/search | Search Food Videos |
MiscAPI | SearchSiteContent | Get /food/site/search | Search Site Content |
MiscAPI | TalkToChatbot | Get /food/converse | Talk to Chatbot |
ProductsAPI | AutocompleteProductSearch | Get /food/products/suggest | Autocomplete Product Search |
ProductsAPI | ClassifyGroceryProduct | Post /food/products/classify | Classify Grocery Product |
ProductsAPI | ClassifyGroceryProductBulk | Post /food/products/classifyBatch | Classify Grocery Product Bulk |
ProductsAPI | GetComparableProducts | Get /food/products/upc/{upc}/comparable | Get Comparable Products |
ProductsAPI | GetProductInformation | Get /food/products/{id} | Get Product Information |
ProductsAPI | ProductNutritionByIDImage | Get /food/products/{id}/nutritionWidget.png | Product Nutrition by ID Image |
ProductsAPI | ProductNutritionLabelImage | Get /food/products/{id}/nutritionLabel.png | Product Nutrition Label Image |
ProductsAPI | ProductNutritionLabelWidget | Get /food/products/{id}/nutritionLabel | Product Nutrition Label Widget |
ProductsAPI | SearchGroceryProducts | Get /food/products/search | Search Grocery Products |
ProductsAPI | SearchGroceryProductsByUPC | Get /food/products/upc/{upc} | Search Grocery Products by UPC |
ProductsAPI | VisualizeProductNutritionByID | Get /food/products/{id}/nutritionWidget | Product Nutrition by ID Widget |
RecipesAPI | AnalyzeARecipeSearchQuery | Get /recipes/queries/analyze | Analyze a Recipe Search Query |
RecipesAPI | AnalyzeRecipeInstructions | Post /recipes/analyzeInstructions | Analyze Recipe Instructions |
RecipesAPI | AutocompleteRecipeSearch | Get /recipes/autocomplete | Autocomplete Recipe Search |
RecipesAPI | ClassifyCuisine | Post /recipes/cuisine | Classify Cuisine |
RecipesAPI | ComputeGlycemicLoad | Post /food/ingredients/glycemicLoad | Compute Glycemic Load |
RecipesAPI | ConvertAmounts | Get /recipes/convert | Convert Amounts |
RecipesAPI | CreateRecipeCard | Post /recipes/visualizeRecipe | Create Recipe Card |
RecipesAPI | EquipmentByIDImage | Get /recipes/{id}/equipmentWidget.png | Equipment by ID Image |
RecipesAPI | ExtractRecipeFromWebsite | Get /recipes/extract | Extract Recipe from Website |
RecipesAPI | GetAnalyzedRecipeInstructions | Get /recipes/{id}/analyzedInstructions | Get Analyzed Recipe Instructions |
RecipesAPI | GetRandomRecipes | Get /recipes/random | Get Random Recipes |
RecipesAPI | GetRecipeEquipmentByID | Get /recipes/{id}/equipmentWidget.json | Equipment by ID |
RecipesAPI | GetRecipeInformation | Get /recipes/{id}/information | Get Recipe Information |
RecipesAPI | GetRecipeInformationBulk | Get /recipes/informationBulk | Get Recipe Information Bulk |
RecipesAPI | GetRecipeIngredientsByID | Get /recipes/{id}/ingredientWidget.json | Ingredients by ID |
RecipesAPI | GetRecipeNutritionWidgetByID | Get /recipes/{id}/nutritionWidget.json | Nutrition by ID |
RecipesAPI | GetRecipePriceBreakdownByID | Get /recipes/{id}/priceBreakdownWidget.json | Price Breakdown by ID |
RecipesAPI | GetRecipeTasteByID | Get /recipes/{id}/tasteWidget.json | Taste by ID |
RecipesAPI | GetSimilarRecipes | Get /recipes/{id}/similar | Get Similar Recipes |
RecipesAPI | GuessNutritionByDishName | Get /recipes/guessNutrition | Guess Nutrition by Dish Name |
RecipesAPI | ParseIngredients | Post /recipes/parseIngredients | Parse Ingredients |
RecipesAPI | PriceBreakdownByIDImage | Get /recipes/{id}/priceBreakdownWidget.png | Price Breakdown by ID Image |
RecipesAPI | QuickAnswer | Get /recipes/quickAnswer | Quick Answer |
RecipesAPI | RecipeNutritionByIDImage | Get /recipes/{id}/nutritionWidget.png | Recipe Nutrition by ID Image |
RecipesAPI | RecipeNutritionLabelImage | Get /recipes/{id}/nutritionLabel.png | Recipe Nutrition Label Image |
RecipesAPI | RecipeNutritionLabelWidget | Get /recipes/{id}/nutritionLabel | Recipe Nutrition Label Widget |
RecipesAPI | RecipeTasteByIDImage | Get /recipes/{id}/tasteWidget.png | Recipe Taste by ID Image |
RecipesAPI | SearchRecipes | Get /recipes/complexSearch | Search Recipes |
RecipesAPI | SearchRecipesByIngredients | Get /recipes/findByIngredients | Search Recipes by Ingredients |
RecipesAPI | SearchRecipesByNutrients | Get /recipes/findByNutrients | Search Recipes by Nutrients |
RecipesAPI | SummarizeRecipe | Get /recipes/{id}/summary | Summarize Recipe |
RecipesAPI | VisualizeEquipment | Post /recipes/visualizeEquipment | Equipment Widget |
RecipesAPI | VisualizePriceBreakdown | Post /recipes/visualizePriceEstimator | Price Breakdown Widget |
RecipesAPI | VisualizeRecipeEquipmentByID | Get /recipes/{id}/equipmentWidget | Equipment by ID Widget |
RecipesAPI | VisualizeRecipeIngredientsByID | Get /recipes/{id}/ingredientWidget | Ingredients by ID Widget |
RecipesAPI | VisualizeRecipeNutrition | Post /recipes/visualizeNutrition | Recipe Nutrition Widget |
RecipesAPI | VisualizeRecipeNutritionByID | Get /recipes/{id}/nutritionWidget | Recipe Nutrition by ID Widget |
RecipesAPI | VisualizeRecipePriceBreakdownByID | Get /recipes/{id}/priceBreakdownWidget | Price Breakdown by ID Widget |
RecipesAPI | VisualizeRecipeTaste | Post /recipes/visualizeTaste | Recipe Taste Widget |
RecipesAPI | VisualizeRecipeTasteByID | Get /recipes/{id}/tasteWidget | Recipe Taste by ID Widget |
WineAPI | GetDishPairingForWine | Get /food/wine/dishes | Dish Pairing for Wine |
WineAPI | GetWineDescription | Get /food/wine/description | Wine Description |
WineAPI | GetWinePairing | Get /food/wine/pairing | Wine Pairing |
WineAPI | GetWineRecommendation | Get /food/wine/recommendation | Wine Recommendation |
- AddMealPlanTemplate200Response
- AddMealPlanTemplate200ResponseItemsInner
- AddMealPlanTemplate200ResponseItemsInnerValue
- AddToMealPlanRequest
- AddToMealPlanRequestValue
- AddToMealPlanRequestValueIngredientsInner
- AddToShoppingListRequest
- AnalyzeARecipeSearchQuery200Response
- AnalyzeARecipeSearchQuery200ResponseDishesInner
- AnalyzeARecipeSearchQuery200ResponseIngredientsInner
- AnalyzeRecipeInstructions200Response
- AnalyzeRecipeInstructions200ResponseIngredientsInner
- AnalyzeRecipeInstructions200ResponseParsedInstructionsInner
- AnalyzeRecipeInstructions200ResponseParsedInstructionsInnerStepsInner
- AnalyzeRecipeInstructions200ResponseParsedInstructionsInnerStepsInnerIngredientsInner
- AnalyzeRecipeRequest
- AutocompleteIngredientSearch200ResponseInner
- AutocompleteProductSearch200Response
- AutocompleteProductSearch200ResponseResultsInner
- AutocompleteRecipeSearch200ResponseInner
- ClassifyCuisine200Response
- ClassifyGroceryProduct200Response
- ClassifyGroceryProductBulk200ResponseInner
- ClassifyGroceryProductBulkRequestInner
- ClassifyGroceryProductRequest
- ComparableProduct
- ComputeGlycemicLoad200Response
- ComputeGlycemicLoad200ResponseIngredientsInner
- ComputeGlycemicLoadRequest
- ComputeIngredientAmount200Response
- ConnectUser200Response
- ConnectUserRequest
- ConvertAmounts200Response
- CreateRecipeCard200Response
- DetectFoodInText200Response
- DetectFoodInText200ResponseAnnotationsInner
- GenerateMealPlan200Response
- GenerateMealPlan200ResponseNutrients
- GetARandomFoodJoke200Response
- GetAnalyzedRecipeInstructions200ResponseInner
- GetAnalyzedRecipeInstructions200ResponseInnerStepsInner
- GetAnalyzedRecipeInstructions200ResponseInnerStepsInnerIngredientsInner
- GetComparableProducts200Response
- GetComparableProducts200ResponseComparableProducts
- GetConversationSuggests200Response
- GetConversationSuggests200ResponseSuggests
- GetConversationSuggests200ResponseSuggestsInner
- GetDishPairingForWine200Response
- GetIngredientSubstitutes200Response
- GetMealPlanTemplate200Response
- GetMealPlanTemplate200ResponseDaysInner
- GetMealPlanTemplate200ResponseDaysInnerItemsInner
- GetMealPlanTemplate200ResponseDaysInnerItemsInnerValue
- GetMealPlanTemplates200Response
- GetMealPlanTemplates200ResponseTemplatesInner
- GetMealPlanWeek200Response
- GetMealPlanWeek200ResponseDaysInner
- GetMealPlanWeek200ResponseDaysInnerItemsInner
- GetMealPlanWeek200ResponseDaysInnerItemsInnerValue
- GetMealPlanWeek200ResponseDaysInnerNutritionSummary
- GetMealPlanWeek200ResponseDaysInnerNutritionSummaryNutrientsInner
- GetRandomRecipes200Response
- GetRecipeEquipmentByID200Response
- GetRecipeEquipmentByID200ResponseEquipmentInner
- GetRecipeIngredientsByID200Response
- GetRecipeIngredientsByID200ResponseIngredientsInner
- GetRecipeNutritionWidgetByID200Response
- GetRecipeNutritionWidgetByID200ResponseBadInner
- GetRecipeNutritionWidgetByID200ResponseGoodInner
- GetRecipePriceBreakdownByID200Response
- GetRecipePriceBreakdownByID200ResponseIngredientsInner
- GetRecipePriceBreakdownByID200ResponseIngredientsInnerAmount
- GetRecipePriceBreakdownByID200ResponseIngredientsInnerAmountMetric
- GetShoppingList200Response
- GetShoppingList200ResponseAislesInner
- GetShoppingList200ResponseAislesInnerItemsInner
- GetShoppingList200ResponseAislesInnerItemsInnerMeasures
- GetShoppingList200ResponseAislesInnerItemsInnerMeasuresOriginal
- GetSimilarRecipes200ResponseInner
- GetWineDescription200Response
- GetWinePairing200Response
- GetWinePairing200ResponseProductMatchesInner
- GetWineRecommendation200Response
- GetWineRecommendation200ResponseRecommendedWinesInner
- GuessNutritionByDishName200Response
- GuessNutritionByDishName200ResponseCalories
- GuessNutritionByDishName200ResponseCaloriesConfidenceRange95Percent
- ImageAnalysisByURL200Response
- ImageAnalysisByURL200ResponseCategory
- ImageAnalysisByURL200ResponseNutrition
- ImageAnalysisByURL200ResponseNutritionCalories
- ImageAnalysisByURL200ResponseNutritionCaloriesConfidenceRange95Percent
- ImageAnalysisByURL200ResponseRecipesInner
- ImageClassificationByURL200Response
- IngredientBasics
- IngredientInformation
- IngredientInformationEstimatedCost
- IngredientInformationNutrition
- IngredientInformationNutritionPropertiesInner
- IngredientSearch200Response
- IngredientSearch200ResponseResultsInner
- MapIngredientsToGroceryProducts200ResponseInner
- MapIngredientsToGroceryProducts200ResponseInnerProductsInner
- MapIngredientsToGroceryProductsRequest
- MenuItem
- MenuItemServings
- ProductInformation
- ProductInformationCredits
- QuickAnswer200Response
- RecipeInformation
- RecipeInformationExtendedIngredientsInner
- RecipeInformationExtendedIngredientsInnerMeasures
- RecipeInformationExtendedIngredientsInnerMeasuresMetric
- RecipeInformationWinePairing
- RecipeInformationWinePairingProductMatchesInner
- SearchAllFood200Response
- SearchAllFood200ResponseSearchResultsInner
- SearchCustomFoods200Response
- SearchCustomFoods200ResponseCustomFoodsInner
- SearchFoodVideos200Response
- SearchFoodVideos200ResponseVideosInner
- SearchGroceryProducts200Response
- SearchGroceryProductsByUPC200Response
- SearchGroceryProductsByUPC200ResponseNutrition
- SearchGroceryProductsByUPC200ResponseNutritionCaloricBreakdown
- SearchGroceryProductsByUPC200ResponseNutritionNutrientsInner
- SearchGroceryProductsByUPC200ResponseServings
- SearchMenuItems200Response
- SearchRecipes200Response
- SearchRecipes200ResponseResultsInner
- SearchRecipesByIngredients200ResponseInner
- SearchRecipesByIngredients200ResponseInnerMissedIngredientsInner
- SearchRecipesByNutrients200ResponseInner
- SearchRestaurants200Response
- SearchRestaurants200ResponseRestaurantsInner
- SearchRestaurants200ResponseRestaurantsInnerAddress
- SearchRestaurants200ResponseRestaurantsInnerLocalHours
- SearchRestaurants200ResponseRestaurantsInnerLocalHoursOperational
- SearchResult
- SearchSiteContent200Response
- SummarizeRecipe200Response
- TalkToChatbot200Response
- TalkToChatbot200ResponseMediaInner
- TasteInformation
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: x-api-key
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: x-api-key and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
spoonacular.ContextAPIKeys,
map[string]spoonacular.APIKey{
"x-api-key": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime