Recipes ======= .. include:: experimental-feature.rst Our Drafts and Posts API support nutrition facts calculation based on recipes information. Every time a draft or a post is being saved or updated, we look at a schemaless field named ``roar_specific_data``. If the featured is enabled for your site and the following parameters are received, our APIs will automatically parse your recipe and will compute nutrition facts. Parameters ********** =============== ============ ====================================================================== Name Type Description =============== ============ ====================================================================== ``ingredients`` String Ingredients text, each line is considered as one ingredient - Required ``servings`` Integer Servings - Optional - Defaults to ``1`` =============== ============ ====================================================================== Request example ############### As an example, we are using a recipe from our client MyRecipeMagic: https://www.myrecipemagic.com/grilled-chicken-marinade-2639881057.html The parameters described above should be sent as part of the payload for creating/updating drafts/posts, as the following: .. code:: json { "headline": "My first recipe", "roar_specific_data": { "servings": 8, "ingredients": "2 cups 7-Up - Don't use the diet stuff! \r\n1 cup Soy Sauce \r\n1\/2 cup vegetable oil \r\n1\/2 tablespoon horseradish \r\n1\/2 teaspoon garlic powder \r\n6-8 skinless ( boneless chicken breasts ) " } } Response ******** The response payload will contain whole information of a post but here, we are going to describe the ``roar_specific_data`` field only, which is also used to store parsed information of ingredients and nutrition facts data. ====================== ================ ====================================================================== Name Type Description ====================== ================ ====================================================================== ``ingredients_parsed`` Array of Objects Parsed information of ingredients ``nutrition_facts`` Object Nutrition facts information ====================== ================ ====================================================================== Ingredient parsed ################# =============== ================ ============ Name Type Description =============== ================ ============ ``quantity`` Float Quantity ``fraction`` Float Fraction ``measurement`` Integer Measurement ``name`` String Name ``comment`` String Comment =============== ================ ============ Nutrition fact ############## The nutrition facts are returned in one object which has a form of a map of code to nutrition fact object. Here are the details: =============== ================ ============ Name Type Description =============== ================ ============ ``description`` String Description ``value`` Float Value ``measurement`` String Measurement ``dec`` Float Decagrams ``group`` String Group =============== ================ ============ Response Example ################ .. code:: json { ... "roar_specific_data": { "servings": 8, "ingredients": "2 cups 7-Up - Don't use the diet stuff! \r\n1 cup Soy Sauce \r\n1/2 cup vegetable oil \r\n1/2 tablespoon horseradish \r\n1/2 teaspoon garlic powder \r\n6-8 skinless ( boneless chicken breasts ) ", "ingredients_parsed": [{ "comment": "None", "measurement": 4, "name": "7-up", "fraction": null, "quantity": 2.0 }, { "comment": "None", "measurement": 4, "name": "soy sauce", "fraction": null, "quantity": 1.0 }, { "comment": "None", "measurement": 4, "name": "vegetable oil", "fraction": 0.5, "quantity": 0 }, { "comment": "None", "measurement": 2, "name": "horseradish", "fraction": 0.5, "quantity": 0 }, { "comment": "None", "measurement": 1, "name": "garlic powder", "fraction": 0.5, "quantity": 0 }, { "comment": "boneless chicken breasts", "measurement": null, "name": "boneless skinless chicken breast", "fraction": null, "quantity": 6.0 }], "nutrition_facts": { "Niacin": { "dec": 2, "group": "6", "description": "Niacin", "value": 3.65, "measurement": "mg" }, "Sodium": { "dec": 0, "group": "6", "description": "Sodium", "value": 2033.0, "measurement": "mg" }, "FatPoly": { "dec": 2, "group": "2", "description": "Polysaturated Fat", "value": 1.27, "measurement": "g" }, "Thiamin": { "dec": 2, "group": "6", "description": "Thiamin", "value": 0.79, "measurement": "mg" }, "Sugar": { "dec": 1, "group": "5", "description": "Sugar", "value": 6.199999999999999, "measurement": "g" }, "B12": { "dec": 2, "group": "7", "description": "Vitamin B12", "value": 1.2000000000000002, "measurement": "Ug" }, "Fiber": { "dec": 1, "group": "5", "description": "Fiber", "value": 1.3, "measurement": "g" }, "FatSat": { "dec": 2, "group": "2", "description": "Saturated Fat", "value": 12.26, "measurement": "g" }, "Potassium": { "dec": 0, "group": "6", "description": "Potassium", "value": 127.0, "measurement": "mg" }, "VitD": { "dec": 1, "group": "7", "description": "Vitamin D", "value": 0, "measurement": "Ug" }, "Carbs": { "dec": 1, "group": "5a", "description": "Carbohydrates", "value": 8.699999999999998, "measurement": "g" }, "TotalFat": { "dec": 2, "group": "2a", "description": "Total Fat", "value": 16.51, "measurement": "g" }, "Calories": { "dec": 0, "group": "1", "description": "Calories", "value": 201.0, "measurement": "" }, "FolicAcid": { "dec": 1, "group": "6", "description": "Folic Acid", "value": 1.3, "measurement": "Ug" }, "VitK": { "dec": 1, "group": "7", "description": "Vitamin K", "value": 3.3, "measurement": "Ug" }, "Calcium": { "dec": 0, "group": "6", "description": "Calcium", "value": 11.0, "measurement": "mg" }, "Riboflavin": { "dec": 2, "group": "6", "description": "Riboflavin", "value": 0.8300000000000001, "measurement": "mg" }, "Iron": { "dec": 2, "group": "6", "description": "Iron", "value": 1.2399999999999998, "measurement": "mg" }, "Cholesterol": { "dec": 2, "group": "6", "description": "Cholesterol", "value": 14.57, "measurement": "mg" }, "VitC": { "dec": 1, "group": "7", "description": "Vitamin C", "value": 1.5, "measurement": "mg" }, "VitA": { "dec": 0, "group": "7", "description": "Vitamin A", "value": 18.0, "measurement": "IU" }, "VitE": { "dec": 2, "group": "7", "description": "Vitamin E", "value": 0.56, "measurement": "mg" }, "FatMono": { "dec": 2, "group": "2", "description": "Monosaturated Fat", "value": 2.9800000000000004, "measurement": "g" }, "VitB6": { "dec": 2, "group": "7", "description": "Vitamin B6", "value": 0.94, "measurement": "mg" }, "Zinc": { "dec": 1, "group": "6", "description": "Zinc", "value": 0.5, "measurement": "mg" }, "Protein": { "dec": 1, "group": "4", "description": "Protein", "value": 8.3, "measurement": "g" } } }, ... }