### Search Whisk API Recipes Source: https://docs.whisk.com/master/guides/quick-start-guide Demonstrates how to search for recipes using the Whisk API. It includes examples for making GET requests with an authorization token and query parameters. The code handles fetching data and logging the number of results. ```javascript const fetch = require("node-fetch"); const headers = { "Content-Type": "application/json", Authorization: process.env.WHISK_GRAPH_KEY }; function searchWhisk(phrase) { const url = `https://graph.whisk.com/v1/search?type=recipe&q=${phrase}`; return fetch(url, { method: "GET", headers }) .then(res => res.json()) .then(responseData => { console.log(`Got ${responseData.data.length} items`); return responseData; }); } ``` ```bash curl "https://graph.whisk.com/v1/search?type=recipe&q=sandwich" \ -H "Accept: application/json" \ -H "Authorization: WHISK_GRAPH_KEY" ``` ```python3 from urllib.request import Request, urlopen from urllib.parse import urlencode import json query = urlencode([('type', 'recipe'), ('q', 'sandwich')]) req = Request('https://graph.whisk.com/v1/search?' + query) req.add_header("Authorization", WHISK_GRAPH_KEY) data = json.load(urlopen(req)) ``` ```python # might need to `pip install requests` import requests url = "https://graph.whisk.com/v1/search?type=recipe&q=sandwich" headers = {"Authorization": WHISK_GRAPH_KEY} data = requests.get(url, headers=headers).json() ``` -------------------------------- ### Example Recipe Data Structure Source: https://docs.whisk.com/master/guides/quick-start-guide Provides an example JSON structure representing a recipe, including details like name, description, ingredients, source information, durations, labels, and constraints. This data is used to display recipe information. ```javascript { "content": { "id": "101ddf209fadc4c6f061bc43416ecad5a7d0b3d6c6a", "name": "Sourdough steak sandwich with bean pesto", "description": "This hearty sandwich makes a great lunch or midweek meal", "ingredients": [ { "text": "4 x 130g thin-cut beef steaks" }, // ... { "text": "1 avocado, sliced" } ], "images": [ // ... ], "videos": [], "source": { "name": "tesco.com", "displayName": "Tesco Real Food", "sourceRecipeUrl": "https://realfood.tesco.com/recipes/sourdough-steak-sandwich-with-bean-pesto.html", "license": "Fairuse" }, "numberOfServings": 4, "durations": { "cookTime": 20, "prepTime": 15, "totalTime": 35 }, "labels": { "cuisine": [ { "name": "british", "displayName": "British" } ], // ... }, "constraints": { "violates": { "diets": [ "pescatarian", "vegan", "vegetarian", "lacto-vegetarian", "ovo-lacto-vegetarian", "ovo-vegetarian", "dairy-free" ], "avoidances": [ "gluten", "wheat", "yeast", "milk", "lactose" ] } }, "author": { "name": "Tesco Real Food" }, "language": "en" }, "matchedIngredients": [ { "name": "meat" }, { "name": "bread" } ] } ``` -------------------------------- ### Example Recipe Data Structure Source: https://docs.whisk.com/api-overview/quick-start-guide Provides an example JSON structure representing a recipe, including details like name, description, ingredients, source information, durations, labels, and constraints. This data is used to display recipe information. ```javascript { "content": { "id": "101ddf209fadc4c6f061bc43416ecad5a7d0b3d6c6a", "name": "Sourdough steak sandwich with bean pesto", "description": "This hearty sandwich makes a great lunch or midweek meal", "ingredients": [ { "text": "4 x 130g thin-cut beef steaks" }, // ... { "text": "1 avocado, sliced" } ], "images": [ // ... ], "videos": [], "source": { "name": "tesco.com", "displayName": "Tesco Real Food", "sourceRecipeUrl": "https://realfood.tesco.com/recipes/sourdough-steak-sandwich-with-bean-pesto.html", "license": "Fairuse" }, "numberOfServings": 4, "durations": { "cookTime": 20, "prepTime": 15, "totalTime": 35 }, "labels": { "cuisine": [ { "name": "british", "displayName": "British" } ], // ... }, "constraints": { "violates": { "diets": [ "pescatarian", "vegan", "vegetarian", "lacto-vegetarian", "ovo-lacto-vegetarian", "ovo-vegetarian", "dairy-free" ], "avoidances": [ "gluten", "wheat", "yeast", "milk", "lactose" ] } }, "author": { "name": "Tesco Real Food" }, "language": "en" }, "matchedIngredients": [ { "name": "meat" }, { "name": "bread" } ] } ``` -------------------------------- ### Shopping List SDK Documentation Source: https://context7_llms Guides and examples for using the Whisk Shopping List SDK, covering basic setup, methods, event listeners, widgets, subscriptions, global configuration, UTM parameters, and usage with Single Page Applications (SPAs). ```APIDOC Overview: /shopping-list-sdk/overview.md Examples: /shopping-list-sdk/examples.md Shoppable Recipes: /shopping-list-sdk/examples/shoppable-recipes.md Shoppable Products: /shopping-list-sdk/examples/shoppable-products.md Shoppable Media: /shopping-list-sdk/examples/shoppable-media.md Basic Setup: /shopping-list-sdk/basic-setup.md Basic Setup Details: /shopping-list-sdk/basic-setup/basic-setup.md Methods: /shopping-list-sdk/basic-setup/methods.md Event Listeners: /shopping-list-sdk/basic-setup/event-listeners.md Widget: /shopping-list-sdk/basic-setup/widget.md Subscriptions: /shopping-list-sdk/basic-setup/subscriptions.md Global Configuration: /shopping-list-sdk/basic-setup/global-configuration.md UTM Parameters: /shopping-list-sdk/basic-setup/utm-parameters.md Using With SPA: /shopping-list-sdk/basic-setup/using-with-spa.md ``` -------------------------------- ### Get All User Recipes API Request Example Source: https://docs.whisk.com/api/recipes/user-recipes-and-collections/get-all-user-recipes Example of how to make a GET request to the /v1/recipes endpoint using curl. It demonstrates setting the Accept header and the Authorization header with an access token. ```bash curl "https://graph.whisk.com/v1/recipes" \ -H "Accept: application/json" \ -H "Authorization: Bearer " ``` -------------------------------- ### Get All User Recipes API Request Example Source: https://docs.whisk.com/master/api/user-recipes-and-collections/get-all-user-recipes Example of how to make a GET request to the /v1/recipes endpoint using curl. It demonstrates setting the Accept header and the Authorization header with an access token. ```bash curl "https://graph.whisk.com/v1/recipes" \ -H "Accept: application/json" \ -H "Authorization: Bearer " ``` -------------------------------- ### Shopping List SDK - Basic Setup Source: https://context7_llms Guides and methods for setting up and configuring the Shopping List SDK. ```APIDOC Shopping List SDK - Basic Setup: - Overview: /shopping-list-sdk/overview.md - Description: General introduction to the SDK. - Examples: /shopping-list-sdk/examples.md - Description: Demonstrates various use cases and functionalities. - Shoppable Recipes: /shopping-list-sdk/examples/shoppable-recipes.md - Description: Example of making recipes shoppable. - Shoppable Products: /shopping-list-sdk/examples/shoppable-products.md - Description: Example of making individual products shoppable. - Shoppable Media: /shopping-list-sdk/examples/shoppable-media.md - Description: Example of making media content shoppable. - Basic Setup: /shopping-list-sdk/basic-setup.md - Description: Core setup instructions. - Basic Setup (Detailed): /shopping-list-sdk/basic-setup/basic-setup.md - Description: Step-by-step guide for initial setup. - Methods: /shopping-list-sdk/basic-setup/methods.md - Description: Details on available SDK methods. - Event Listeners: /shopping-list-sdk/basic-setup/event-listeners.md - Description: How to implement and use event listeners. - Widget: /shopping-list-sdk/basic-setup/widget.md - Description: Information on integrating the SDK widget. - Subscriptions: /shopping-list-sdk/basic-setup/subscriptions.md - Description: Details on managing SDK subscriptions. - Global Configuration: /shopping-list-sdk/basic-setup/global-configuration.md - Description: How to configure SDK settings globally. - UTM Parameters: /shopping-list-sdk/basic-setup/utm-parameters.md - Description: Usage of UTM parameters within the SDK. - Using With SPA: /shopping-list-sdk/basic-setup/using-with-spa.md - Description: Guidance on integrating the SDK with Single Page Applications. ``` -------------------------------- ### Curl Call Example for Get Meal Plan Settings Source: https://docs.whisk.com/api/meal-plans/get-meal-plan-settings/get-meal-plan-settings Demonstrates how to call the GET /mealplan/v2/settings endpoint using curl, including necessary headers for authentication and content negotiation. ```bash curl -X GET "https://api.whisk.com/mealplan/v2/settings" \ -H "accept: application/json" \ -H "Authorization: Bearer " ``` -------------------------------- ### Whisk API Search Endpoint Source: https://docs.whisk.com/api-overview/quick-start-guide Demonstrates how to search for recipes using the Whisk API. It shows how to construct the GET request, include the authorization token, and handle the response. The API call targets the `/v1/search` endpoint with query parameters for recipe type and search phrase. ```javascript const fetch = require("node-fetch"); const headers = { "Content-Type": "application/json", Authorization: process.env.WHISK_GRAPH_KEY }; function searchWhisk(phrase) { const url = `https://graph.whisk.com/v1/search?type=recipe&q=${phrase}`; return fetch(url, { method: "GET", headers }) .then(res => res.json()) .then(responseData => { console.log(`Got ${responseData.data.length} items`); return responseData; }); } ``` ```bash curl "https://graph.whisk.com/v1/search?type=recipe&q=sandwich" \ -H "Accept: application/json" \ -H "Authorization: WHISK_GRAPH_KEY" ``` ```python from urllib.request import Request, urlopen from urllib.parse import urlencode import json query = urlencode([('type', 'recipe'), ('q', 'sandwich')]) req = Request('https://graph.whisk.com/v1/search?' + query) req.add_header("Authorization", WHISK_GRAPH_KEY) data = json.load(urlopen(req)) ``` ```python # might need to `pip install requests` import requests url = "https://graph.whisk.com/v1/search?type=recipe&q=sandwich" headers = {"Authorization": WHISK_GRAPH_KEY} data = requests.get(url, headers=headers).json() ``` -------------------------------- ### Sample Request for Similar Recipes Source: https://docs.whisk.com/master/api/recipe-discovery/get-similar-recipes Example cURL command to fetch similar recipes using the /v1/feed endpoint. ```bash curl "https://graph.whisk.com/v1/feed?type=related&itemId=9773cb7eca5d11e7ae7e42010a9a0035&limit=3" \ -H "Accept: application/json" \ -H "Authorization: Token " ``` -------------------------------- ### Whisk API Sandbox Recipe Search Example Source: https://docs.whisk.com/master/guides/whisk-sandbox Demonstrates how to perform a recipe search using the Whisk API sandbox. This example utilizes `curl` to make a GET request to the sandbox endpoint, requiring an authorization token. ```curl curl "https://testkitchen.whisk.com/v1/search?type=recipe" \ -H "Authorization: Token " ``` -------------------------------- ### Include Whisk Javascript SDK Source: https://docs.whisk.com/shopping-list-sdk/basic-setup/basic-setup Includes the Whisk Javascript SDK script asynchronously from a CDN and initializes the global `whisk` object with a queue for deferred execution. ```markup ``` -------------------------------- ### Queue Whisk SDK Commands Source: https://docs.whisk.com/shopping-list-sdk/basic-setup/basic-setup Demonstrates how to push functions onto the `whisk.queue` array. This ensures that SDK commands are executed only after the Whisk SDK has fully loaded, handling asynchronous loading scenarios. ```javascript whisk.queue.push(function() { whisk.shoppingList.viewList(); }); ``` -------------------------------- ### Queue Whisk SDK Commands Source: https://docs.whisk.com/master/shopping-list-sdk/basic-setup/basic-setup Demonstrates how to push functions onto the `whisk.queue` array. This ensures that SDK commands are executed only after the Whisk SDK has fully loaded, handling asynchronous loading scenarios. ```javascript whisk.queue.push(function() { whisk.shoppingList.viewList(); }); ``` -------------------------------- ### Include Whisk Javascript SDK Source: https://docs.whisk.com/master/shopping-list-sdk/basic-setup/basic-setup Includes the Whisk Javascript SDK script asynchronously from a CDN and initializes the global `whisk` object with a queue for deferred execution. ```markup ``` -------------------------------- ### Get All User Recipes API Response Example Source: https://docs.whisk.com/master/api/user-recipes-and-collections/get-all-user-recipes Example of a successful JSON response when fetching all user recipes. It includes a list of recipes with their details and pagination information. ```javascript { "recipes": [ { "collections": [ { "id": "97f77cceca5d11e7ae7e42010a9a0035", "name": "My collection" } ], "content": { "id": "97f77cceca5d11e7ae7e42010a9a0035", "name": "Quick coronation chicken sandwich", "description": "Use leftover roast chicken to make a delicious coronation chicken sandwich ready to pack in your lunchbox.", "images": [ { "url": "http://cdnwp.audiencemedia.com/wp-content/uploads/2015/01/478091-1-eng-GB_coronation-chick-sandwich-470x540.jpg", "responsive": { "url": "https://lh3.googleusercontent.com/crjY_vyxK8kdBYYBd6VVtlGwIXuG3pn9DuCSWP4-_VtURbrYfpKPrYDMmrlCwc8kqSAsgCBtjhqU2C7PEjU0wMDh4FSK", "width": 470, "height": 540 } }, { "url": "http://cdnwp.audiencemedia.com/wp-content/uploads/2015/01/478091-1-eng-GB_coronation-chick-sandwich.jpg", "responsive": { "url": "https://lh3.googleusercontent.com/fz02xdShfu1ax6ZZLhMp2zn7WwGXN7XlVx6ZXR8X_uN-x5DEdCW_Q9tIacitVtyI-yIkxZ6-nqpLCQIrPNijwM4wIPg", "width": 960, "height": 927 } } ], "source": { "name": "deliciousmagazine.co.uk", "displayName": "delicious. magazine", "sourceRecipeUrl": "http://www.deliciousmagazine.co.uk/recipes/quick-coronation-chicken-sandwich/", "license": "Fairuse" }, "numberOfServings": 1, "labels": { "mealType": [], "cuisine": [], "category": [ { "name": "quick-and-easy", "displayName": "Quick and easy" } ] } }, "matchedIngredients": [ { "name": "meat" }, { "name": "bread" } ] }, ... ], "paging": { "total": 14, "cursors": { "after": "eyJpZCI6ImNhZjVlOWY3Y2YxNzFkYjBmZTdkYjJmOTM4M2M0ZDIzIiwiaW5kZXgiOjF9" } } } ``` -------------------------------- ### Whisk SDK - Core Initialization and Event Handling Source: https://docs.whisk.com/shopping-list-sdk/examples/shoppable-recipes This snippet demonstrates the basic setup for the Whisk SDK, ensuring the whisk object and its queue are initialized. It's a prerequisite for most SDK functionalities, including event listeners and subscriptions. ```javascript var whisk = whisk || {}; whisk.queue = whisk.queue || []; ``` -------------------------------- ### Get All User Recipes API Response Example Source: https://docs.whisk.com/api/recipes/user-recipes-and-collections/get-all-user-recipes Example of a successful JSON response when fetching all user recipes. It includes a list of recipes with their details and pagination information. ```javascript { "recipes": [ { "collections": [ { "id": "97f77cceca5d11e7ae7e42010a9a0035", "name": "My collection" } ], "content": { "id": "97f77cceca5d11e7ae7e42010a9a0035", "name": "Quick coronation chicken sandwich", "description": "Use leftover roast chicken to make a delicious coronation chicken sandwich ready to pack in your lunchbox.", "images": [ { "url": "http://cdnwp.audiencemedia.com/wp-content/uploads/2015/01/478091-1-eng-GB_coronation-chick-sandwich-470x540.jpg", "responsive": { "url": "https://lh3.googleusercontent.com/crjY_vyxK8kdBYYBd6VVtlGwIXuG3pn9DuCSWP4-_VtURbrYfpKPrYDMmrlCwc8kqSAsgCBtjhqU2C7PEjU0wMDh4FSK", "width": 470, "height": 540 } }, { "url": "http://cdnwp.audiencemedia.com/wp-content/uploads/2015/01/478091-1-eng-GB_coronation-chick-sandwich.jpg", "responsive": { "url": "https://lh3.googleusercontent.com/fz02xdShfu1ax6ZZLhMp2zn7WwGXN7XlVx6ZXR8X_uN-x5DEdCW_Q9tIacitVtyI-yIkxZ6-nqpLCQIrPNijwM4wIPg", "width": 960, "height": 927 } } ], "source": { "name": "deliciousmagazine.co.uk", "displayName": "delicious. magazine", "sourceRecipeUrl": "http://www.deliciousmagazine.co.uk/recipes/quick-coronation-chicken-sandwich/", "license": "Fairuse" }, "numberOfServings": 1, "labels": { "mealType": [], "cuisine": [], "category": [ { "name": "quick-and-easy", "displayName": "Quick and easy" } ] } }, "matchedIngredients": [ { "name": "meat" }, { "name": "bread" } ] }, ... ], "paging": { "total": 14, "cursors": { "after": "eyJpZCI6ImNhZjVlOWY3Y2YxNzFkYjBmZTdkYjJmOTM4M2M0ZDIzIiwiaW5kZXgiOjF9" } } } ``` -------------------------------- ### Curl Example: Get Food Data Source: https://docs.whisk.com/api/food-db/get-food An example using curl to make a GET request to the Whisk Food API. It demonstrates how to pass food identifiers and specify response fields. ```bash curl -X GET "https://api.whisk.com/food/v2/get?food_hits=CiMyMDJlNjM2M2Q3YWRkNjU0ZmI2OGZmZTNkZGM1ODliMzY5ZA==&food_hits=CiMyMDI2OTdjYjQ5MGU5YmM0MTMzYTg5OWYzOWJhZTI3NmEyZQ==&language=en&country=gb&response_mask.paths=title&response_mask.paths=brand&response_mask.paths=nutrition&response_mask.paths=measures" -H "accept: application/json" -H "Authorization: Bearer %WHISK_TOKEN%" ``` -------------------------------- ### Initialize Whisk SDK Source: https://docs.whisk.com/shopping-list-sdk/examples/shoppable-media This snippet initializes the Whisk SDK by ensuring the whisk object and its queue are available. It's a foundational step before adding any specific listeners or configurations. ```javascript var whisk = whisk || {}; whisk.queue = whisk.queue || []; ``` -------------------------------- ### Example API Call Source: https://docs.whisk.com/api-overview/whisk-sandbox Demonstrates how to make a sample API request to the Whisk Sandbox using curl. This example shows a recipe search query and requires an Authorization token. ```bash curl "https://testkitchen.whisk.com/v1/search?type=recipe" \ -H "Authorization: Token " ``` -------------------------------- ### Error Response Example (Internal Server Error) Source: https://docs.whisk.com/api/meal-plans/get-meal-plan-settings/get-meal-plan-settings Example of a server-side error response, indicating an issue on the Whisk platform. ```javascript This is unexpected response, something is wrong on our side, please contact: help@whisk.com ``` -------------------------------- ### Initialize Whisk SDK Source: https://docs.whisk.com/master/shopping-list-sdk/examples/shoppable-media Initializes the Whisk SDK by ensuring the whisk object and its queue are available. This script should be added once to your page, ideally in the head. ```javascript var whisk = whisk || {}; whisk.queue = whisk.queue || []; ``` -------------------------------- ### Unauthorized Response Example Source: https://docs.whisk.com/api/provisioning/get-provisioning Example of an unauthorized response (401) from the API, indicating an authentication failure with a specific error code. ```json { "code": "auth.tokenNotFound" } ``` -------------------------------- ### Error Response Example (Unauthorized) Source: https://docs.whisk.com/api/meal-plans/get-meal-plan-settings/get-meal-plan-settings Example JSON structure for an unauthorized response, indicating authentication failure with specific error codes. ```javascript { "code": "auth.tokenNotFound" } ``` -------------------------------- ### POST /v1/recipes - Create Recipe Source: https://docs.whisk.com/api/recipes/user-recipes-and-collections/create-a-recipe This endpoint allows building a recipe from scratch. It requires user access-token integration. The request includes optional query parameters and a structured request body defining the recipe's name, description, ingredients, images, instructions, and other details. ```APIDOC POST /v1/recipes Endpoint allows building recipe from scratch. Available only for user access-token integration. Request Parameters: fields (array [string]): Extra fields to return on the recipe. Possible values: normalizedIngredients, instructions, nutrition. Request Body: collectionIds (array [string]): Collection identifiers recipe should be added to. payload* (RecipePayload): Recipe content. RecipePayload: name* (string): Recipe name. description (string): Recipe description. ingredients (array [RawIngredient]): Recipe ingredients. images (array [OriginalImage]): Recipe images. instructions (RecipeInstructions): Recipe instruction steps. durations (RecipeDurations): Recipe cooking timing. source (ManualRecipeSource): Source of the recipe, e.g. web site. servings (number): Number of servings. RawIngredient: text* (string): Ingredient text. group (string): Ingredient group. RecipeInstructions: steps* (array [RecipeInstruction]): List of instruction steps. RecipeInstruction: text* (string): Instruction text. group (string): Instruction group. images (array [ImageContainer]): Images associated with the instruction step. ImageContainer: url* (string): Original image url, deprecated. Please use field 'original' instead. original (OriginalImage): Original image information, e.g. image url. responsive* (ResponsiveImage): Responsive image details. ResponsiveImage: url* (string): Hosted url of an image. width* (integer): Image width. height* (integer): Image height. OriginalImage: url* (string): URL of the image. ManualRecipeSource: name* (string): Source name. displayName (string): Display name for the source. sourceRecipeUrl (string): URL of the recipe on the source website. license (string): License information. image (ImageContainer): Image associated with the source. Response: recipe* (ManualRecipeDetails): Recipe details. ManualRecipeDetails (structure inferred from RecipePayload and other types): name (string) description (string) ingredients (array [NormalizedIngredient]) images (array [ImageContainer]) instructions (RecipeInstructions) durations (RecipeDurations) source (RecipeSource) servings (number) normalizedIngredients (array [NormalizedIngredient]) NormalizedIngredient: text* (string): Normalized ingredient text. group (string): Ingredient group. analysis (RecipeIngredientAnalysis): Analysis of the ingredient. RecipeIngredientAnalysis: product* (string): Identified product. canonicalName* (string): Canonical name of the product. quantity (number): Quantity of the ingredient. unit (string): Unit of measurement. multiplier (number): Multiplier for the quantity. brand (string): Brand of the product. comment (string): Additional comment about the ingredient. category (string): Category of the ingredient. RecipeDurations: (structure not detailed, assumed to contain timing information) ProductCategory: name* (string): Name of the product category. Error Conditions: - Missing required fields in payload. - Invalid data types for parameters. - Authentication/Authorization errors (access-token). ``` -------------------------------- ### Successful Get Meal Plan Settings Response Source: https://docs.whisk.com/api/meal-plans/get-meal-plan-settings/get-meal-plan-settings Example JSON structure for a successful response when retrieving meal plan settings. ```javascript { "settings": { "servings": 2, "calorie_per_day": 4000, "included_days": [ "DAY_OF_WEEK_INVALID" ], "included_meal_types": [ "MEAL_TYPE_INVALID" ], "enabled_auto_generation": true, "week_template": [ ... ], "replace_only_generated": true, "week_start": "DAY_OF_WEEK_MONDAY", "generation_algorithm": "GENERATION_ALGORITHM_3_MEAL", "food_settings": { ... }, "custom_labels": { ... } } } ``` -------------------------------- ### Get Cart Item Options Sample Request Source: https://docs.whisk.com/master/api/carts/get-cart-item-options Example of how to call the 'Get Cart Item Options' API endpoint using curl, including necessary headers for authentication and content negotiation. ```bash curl "https://graph.whisk.com/v1/39247bbe44e145578ede8cab9fa89dd1/items/89362f250e6b42208eb3982a95e70144/options" \ -H "Accept: application/json" \ -H "Authorization: Token " ``` -------------------------------- ### Get Recipes Request Example (Bash) Source: https://docs.whisk.com/master/api/user-recipes-and-collections/get-recipes-from-a-collection This bash script demonstrates how to make a GET request to the Whisk API to fetch recipes from a collection using curl. It includes necessary headers for authentication and content negotiation. ```bash curl "https://graph.whisk.com/v1/9773cb7eca5d11e7ae7e42010a9a0035/recipes" \ -H "Accept: application/json" \ -H "Authorization: Bearer " ``` -------------------------------- ### Customized AMP Integration Example Source: https://docs.whisk.com/shopping-list-sdk/basic-setup/widget Illustrates an AMP integration with the Whisk widget, showcasing how to apply various customization parameters via the src attribute. This example modifies link color, button border-radius, button color, and specifies allowed retailers for online checkout. ```markup ``` -------------------------------- ### Get Recipe Categories Curl Request Source: https://docs.whisk.com/master/api/recipes/recipe-categories This example demonstrates how to call the 'Get Recipe Categories' API endpoint using curl. It shows the necessary headers and query parameters to specify the country and limit for the request. ```bash curl "https://graph.whisk.com/v1/recipes/categories?country=gb&limit=5" \ -H "Accept: application/json" \ -H "Authorization: Token " ``` -------------------------------- ### Initialize Whisk SDK Source: https://docs.whisk.com/master/shopping-list-sdk/examples/shoppable-recipes This snippet shows the basic initialization of the Whisk SDK by ensuring the `whisk` object and its `queue` array are defined. This is a prerequisite for using most Whisk SDK functionalities. ```javascript var whisk = whisk || {}; whisk.queue = whisk.queue || []; ``` -------------------------------- ### Get Cart Item Options Response Example Source: https://docs.whisk.com/master/api/carts/get-cart-item-options A sample JSON response for the 'Get Cart Item Options' API call, illustrating the structure of the 'options' array containing alternative product suggestions. ```javascript { "options": [ { "sku": "299626009", "name": "Tesco 15 Eggs", "quantity": { "count": 1 }, "price": { "list": 1.19 }, "images": [ { "url": "https://img.tesco.com/Groceries/pi/043/5057545736043/IDShot_540x540.jpg" } ], "url": "https://www.tesco.com/groceries/en-GB/products/299626009" }, ... { "sku": "265422924", "name": "Tesco Mixed Sized Free Range Eggs 15 Pack", "quantity": { "count": 1 }, "price": { "list": 2 }, "images": [ { "url": "https://img.tesco.com/Groceries/pi/706/5052003671706/IDShot_540x540.jpg" } ], "url": "https://www.tesco.com/groceries/en-GB/products/265422924" } ] } ``` -------------------------------- ### Whisk SDK Initialization Source: https://docs.whisk.com/shopping-list-sdk/examples/shoppable-products Initializes the Whisk SDK by ensuring the whisk object and its queue are available. This script should be added once to your page, ideally in the head. ```javascript var whisk = whisk || {}; whisk.queue = whisk.queue || []; ``` -------------------------------- ### Get Recipes Request Example (Bash) Source: https://docs.whisk.com/api/recipes/user-recipes-and-collections/get-recipes-from-a-collection This bash script demonstrates how to make a GET request to the Whisk API to fetch recipes from a collection using curl. It includes necessary headers for authentication and content negotiation. ```bash curl "https://graph.whisk.com/v1/9773cb7eca5d11e7ae7e42010a9a0035/recipes" \ -H "Accept: application/json" \ -H "Authorization: Bearer " ``` -------------------------------- ### POST /v1/recipes - Create Recipe Source: https://docs.whisk.com/master/api/user-recipes-and-collections/create-a-recipe This endpoint allows building a recipe from scratch. It requires user access-token integration. The request includes optional query parameters and a structured request body defining the recipe's name, description, ingredients, images, instructions, and other details. ```APIDOC POST /v1/recipes Endpoint allows building recipe from scratch. Available only for user access-token integration. Request Parameters: fields (array [string]): Extra fields to return on the recipe. Possible values: normalizedIngredients, instructions, nutrition. Request Body: collectionIds (array [string]): Collection identifiers recipe should be added to. payload* (RecipePayload): Recipe content. RecipePayload: name* (string): Recipe name. description (string): Recipe description. ingredients (array [RawIngredient]): Recipe ingredients. images (array [OriginalImage]): Recipe images. instructions (RecipeInstructions): Recipe instruction steps. durations (RecipeDurations): Recipe cooking timing. source (ManualRecipeSource): Source of the recipe, e.g. web site. servings (number): Number of servings. RawIngredient: text* (string): Ingredient text. group (string): Ingredient group. RecipeInstructions: steps* (array [RecipeInstruction]): List of instruction steps. RecipeInstruction: text* (string): Instruction text. group (string): Instruction group. images (array [ImageContainer]): Images associated with the instruction step. ImageContainer: url* (string): Original image url, deprecated. Please use field 'original' instead. original (OriginalImage): Original image information, e.g. image url. responsive* (ResponsiveImage): Responsive image details. ResponsiveImage: url* (string): Hosted url of an image. width* (integer): Image width. height* (integer): Image height. OriginalImage: url* (string): URL of the image. ManualRecipeSource: name* (string): Source name. displayName (string): Display name for the source. sourceRecipeUrl (string): URL of the recipe on the source website. license (string): License information. image (ImageContainer): Image associated with the source. Response: recipe* (ManualRecipeDetails): Recipe details. ManualRecipeDetails (structure inferred from RecipePayload and other types): name (string) description (string) ingredients (array [NormalizedIngredient]) images (array [ImageContainer]) instructions (RecipeInstructions) durations (RecipeDurations) source (RecipeSource) servings (number) normalizedIngredients (array [NormalizedIngredient]) NormalizedIngredient: text* (string): Normalized ingredient text. group (string): Ingredient group. analysis (RecipeIngredientAnalysis): Analysis of the ingredient. RecipeIngredientAnalysis: product* (string): Identified product. canonicalName* (string): Canonical name of the product. quantity (number): Quantity of the ingredient. unit (string): Unit of measurement. multiplier (number): Multiplier for the quantity. brand (string): Brand of the product. comment (string): Additional comment about the ingredient. category (string): Category of the ingredient. RecipeDurations: (structure not detailed, assumed to contain timing information) ProductCategory: name* (string): Name of the product category. Error Conditions: - Missing required fields in payload. - Invalid data types for parameters. - Authentication/Authorization errors (access-token). ```