TheCocktailDB.com - An Open Cocktail Database with API
(2022-02-16, 17:31)tomfuller Wrote: Hi wondering if anyone can help.  I'm currently in a coding bootcamp and am using the cocktailDB api as part of a project and I'm having an issue creating a dynamic link to a cocktail ingredient.  If I use the api to get details of an ingredient e.g. `https://www.thecocktaildb.com/api/json/v1/1/search.php?i=vodka`
I don't get the ingredient imageUrl.  I've tried constructing from the ingredient name, ie.`www.thecocktaildb.com/images/ingredients/${strIngredient}-Small.png`, but this only works for a few as there are a lot of other naming conventions.  Is there any api route  that includes the ingredient image path?

Thanks.

Ingredient name should match the Image name exactly. You will need to encode the spaces though I think. Example:
 
Code:
https://www.thecocktaildb.com/images/ingredients/Vodka-Small.png
https://www.thecocktaildb.com/images/ingredients/Iced%20Tea-Small.png
Reply


Messages In This Thread
RE: TheCocktailDB.com - An Open Cocktail Database with API - by docwra - 2022-02-23, 20:57
Logout Mark Read Team Forum Stats Members Help
TheCocktailDB.com - An Open Cocktail Database with API2