Professional Recipe Nutrients API - Nutrientizer is a cross browsers REST API which get a JSON input as recipe with ingredients and quantities (in grames) and returns a very detailed and exhaustive JSON list of nutrients including vitamins, minerals with its quantities per each ingredient. This recipe nutrition calculator API computes totals of recipe for calories, lipids, proteins, carbohydrates, sugars, fibers, cholesterol, fatty acids (trans, saturated, monounsaturated, polyunsaturated). You may name this api also: recipe nutrition calculator usda, nutritional analysis calculator, recipe nutrition analyzer, recipe nutritional value calculator, recipe nutrition facts calculator, food calorie calculator recipe, recipe calorie and nutrition calculator, recipe builder calorie counter, recipe calorie analyzer, recipe nutrition calculator online, find nutritional value of recipe, recipe nutritional information calculator.
Allthough this Professional Recipe Nutrients API or recipe nutrition calculator is intended for software development and therefore developers, we have also here an online application that may be used to get recipe nutrients from the input text The necessary steps are written below, basically for nutritional analysis calculator API you send an authorized POST request in JSON format to the API endpoint and you get as JSON response a representing the recipe with nutrients per each ingredient and totals. You own the commercial copyright of the resulted JSON recipe with no additional fee meaning you may use it in your own apps.
Professional Recipe Nutrients API is useful for a large number of domains like: restaurants, dietary, food manufacturers, nutritionists, developers making food nutrition apps etc.
For using our recipe nutrition calculator API and/or APP you must create an account (free of charge, no card required), activate it from your received email, login and then start your TRIAL package with no fees as you can see at our pricing packages. After you have tested the recipe nutrition analyzer API and/or APP and you are satisfied, you may buy a paid package. You will always see at your Admin Console page the real resources consumption in real time, your invoices, you may see/edit/delete your profile or export log consents as GDPR instructed, you may read our FAQs.
https://gatiosoft.ro/nutrientizer.aspx
Authorization: Basic //Your username:password are base64 encoded string Content-Type: application/json Accept: application/json
[ { "ingredient": "wheat flour organic", "quantity": 200.0 }, { "ingredient": "broccoli raw", "quantity": 200.0 } ]
{ "op": [ { "ingredient": "Organic Wheat flour", "quantity": 200.0, "nutrient": [ { "name": "Calcium, Ca", "quantity": 39.0, "um": "mg", "total_qty": 78.0 }, { "name": "Iron, Fe", "quantity": 0.71, "um": "mg", "total_qty": 1.42 }, { "name": "Vitamin A, IU", "quantity": 0.0, "um": "IU", "total_qty": 0.0 }, { "name": "Vitamin C, total ascorbic acid", "quantity": 0.0, "um": "mg", "total_qty": 0.0 }, { "name": "Cholesterol", "quantity": 0.0, "um": "mg", "total_qty": 0.0 }, { "name": "Fatty acids, total saturated", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "Protein", "quantity": 7.84, "um": "g", "total_qty": 15.68 }, { "name": "Total lipid (fat)", "quantity": 8.82, "um": "g", "total_qty": 17.64 }, { "name": "Carbohydrate, by difference", "quantity": 50.98, "um": "g", "total_qty": 101.96 }, { "name": "Energy", "quantity": 314.0, "um": "kcal", "total_qty": 628.0 }, { "name": "Sugars, total including NLEA", "quantity": 1.96, "um": "g", "total_qty": 3.92 }, { "name": "Fiber, total dietary", "quantity": 2.0, "um": "g", "total_qty": 4.0 }, { "name": "Sodium, Na", "quantity": 686.0, "um": "mg", "total_qty": 1372.0 }, { "name": "Fatty acids, total trans", "quantity": 0.0, "um": "g", "total_qty": 0.0 } ] }, { "ingredient": "Broccoli, raw", "quantity": 200.0, "nutrient": [ { "name": "Protein", "quantity": 2.82, "um": "g", "total_qty": 5.64 }, { "name": "Total lipid (fat)", "quantity": 0.37, "um": "g", "total_qty": 0.74 }, { "name": "Carbohydrate, by difference", "quantity": 6.64, "um": "g", "total_qty": 13.28 }, { "name": "Energy", "quantity": 34.0, "um": "kcal", "total_qty": 68.0 }, { "name": "Alcohol, ethyl", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "Water", "quantity": 89.3, "um": "g", "total_qty": 178.6 }, { "name": "Caffeine", "quantity": 0.0, "um": "mg", "total_qty": 0.0 }, { "name": "Theobromine", "quantity": 0.0, "um": "mg", "total_qty": 0.0 }, { "name": "Sugars, total including NLEA", "quantity": 1.7, "um": "g", "total_qty": 3.4 }, { "name": "Fiber, total dietary", "quantity": 2.6, "um": "g", "total_qty": 5.2 }, { "name": "Calcium, Ca", "quantity": 47.0, "um": "mg", "total_qty": 94.0 }, { "name": "Iron, Fe", "quantity": 0.73, "um": "mg", "total_qty": 1.46 }, { "name": "Magnesium, Mg", "quantity": 21.0, "um": "mg", "total_qty": 42.0 }, { "name": "Phosphorus, P", "quantity": 66.0, "um": "mg", "total_qty": 132.0 }, { "name": "Potassium, K", "quantity": 316.0, "um": "mg", "total_qty": 632.0 }, { "name": "Sodium, Na", "quantity": 33.0, "um": "mg", "total_qty": 66.0 }, { "name": "Zinc, Zn", "quantity": 0.41, "um": "mg", "total_qty": 0.82 }, { "name": "Copper, Cu", "quantity": 0.049, "um": "mg", "total_qty": 0.0980000049 }, { "name": "Selenium, Se", "quantity": 2.5, "um": "µg", "total_qty": 5.0 }, { "name": "Retinol", "quantity": 0.0, "um": "µg", "total_qty": 0.0 }, { "name": "Vitamin A, RAE", "quantity": 31.0, "um": "µg", "total_qty": 62.2 }, { "name": "Carotene, beta", "quantity": 361.0, "um": "µg", "total_qty": 722.0 }, { "name": "Carotene, alpha", "quantity": 25.0, "um": "µg", "total_qty": 50.0 }, { "name": "Vitamin E (alpha-tocopherol)", "quantity": 0.78, "um": "mg", "total_qty": 1.56 }, { "name": "Vitamin D (D2 + D3)", "quantity": 0.0, "um": "µg", "total_qty": 0.0 }, { "name": "Cryptoxanthin, beta", "quantity": 1.0, "um": "µg", "total_qty": 2.0 }, { "name": "Lycopene", "quantity": 0.0, "um": "µg", "total_qty": 0.0 }, { "name": "Lutein + zeaxanthin", "quantity": 1403.0, "um": "µg", "total_qty": 2806.0 }, { "name": "Vitamin C, total ascorbic acid", "quantity": 89.2, "um": "mg", "total_qty": 178.4 }, { "name": "Thiamin", "quantity": 0.071, "um": "mg", "total_qty": 0.142 }, { "name": "Riboflavin", "quantity": 0.117, "um": "mg", "total_qty": 0.234 }, { "name": "12:0", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "Vitamin B-6", "quantity": 0.175, "um": "mg", "total_qty": 0.35 }, { "name": "Folate, total", "quantity": 63.0, "um": "µg", "total_qty": 126.0 }, { "name": "Vitamin B-12", "quantity": 0.0, "um": "µg", "total_qty": 0.0 }, { "name": "Choline, total", "quantity": 18.7, "um": "mg", "total_qty": 37.4 }, { "name": "Vitamin K (phylloquinone)", "quantity": 101.6, "um": "µg", "total_qty": 203.2 }, { "name": "Folic acid", "quantity": 0.0, "um": "µg", "total_qty": 0.0 }, { "name": "Folate, food", "quantity": 63.0, "um": "µg", "total_qty": 126.0 }, { "name": "Folate, DFE", "quantity": 63.0, "um": "µg", "total_qty": 126.0 }, { "name": "Vitamin E, added", "quantity": 0.0, "um": "mg", "total_qty": 0.0 }, { "name": "Vitamin B-12, added", "quantity": 0.0, "um": "µg", "total_qty": 0.0 }, { "name": "Cholesterol", "quantity": 0.0, "um": "mg", "total_qty": 0.0 }, { "name": "Fatty acids, total saturated", "quantity": 0.039, "um": "g", "total_qty": 0.078 }, { "name": "4:0", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "6:0", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "8:0", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "10:0", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "Niacin", "quantity": 0.639, "um": "mg", "total_qty": 1.278 }, { "name": "14:0", "quantity": 0.001, "um": "g", "total_qty": 0.002 }, { "name": "16:0", "quantity": 0.029, "um": "g", "total_qty": 0.058 }, { "name": "18:0", "quantity": 0.006, "um": "g", "total_qty": 0.012 }, { "name": "18:1", "quantity": 0.01, "um": "g", "total_qty": 0.02 }, { "name": "18:2", "quantity": 0.017, "um": "g", "total_qty": 0.034 }, { "name": "16:0", "quantity": 0.029, "um": "mg", "total_qty": 0.058 }, { "name": "20:4", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "22:6 n-3 (DHA)", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "16:1", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "18:4", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "20:1", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "20:5 n-3 (EPA)", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "22:1", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "22:5 n-3 (DPA)", "quantity": 0.0, "um": "g", "total_qty": 0.0 }, { "name": "Fatty acids, total monounsaturated", "quantity": 0.011, "um": "g", "total_qty": 0.022 }, { "name": "Fatty acids, total polyunsaturated", "quantity": 0.038, "um": "g", "total_qty": 0.076 } ] } ], "energy": 696.0, "cholesterol": 0.0, "calcium": 172.0, "lipids": 18.38, "carbohydrates": 115.24, "proteins": 21.32, "fibers": 9.2, "sugars": 7.32, "saturated_fatts": 0.078, "trans_fatts": 0.0, "monounsaturated_fatts": 0.022, "polyunsaturated_fatts": 0.076 }
{ "cd": "1001", "description": "The authorization header Is either empty Or isn't Basic" }
Ingredient Organic Wheat flour Quantity 200 Nutrient N_Quantity Units Total_qty Ingredient Quantity Nutrient Calcium, Ca N_Quantity 39.00000 Units mg Total_qty 78.00000 Ingredient Quantity Nutrient Iron, Fe N_Quantity .71000 Units mg Total_qty 1.42000 Ingredient Quantity Nutrient Vitamin A, IU N_Quantity .00000 Units IU Total_qty .00000 Ingredient Quantity Nutrient Vitamin C, total ascorbic acid N_Quantity .00000 Units mg Total_qty .00000 Ingredient Quantity Nutrient Cholesterol N_Quantity .00000 Units mg Total_qty .00000 Ingredient Quantity Nutrient Fatty acids, total saturated N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient Protein N_Quantity 7.84000 Units g Total_qty 15.68000 Ingredient Quantity Nutrient Total lipid (fat) N_Quantity 8.82000 Units g Total_qty 17.64000 Ingredient Quantity Nutrient Carbohydrate, by difference N_Quantity 50.98000 Units g Total_qty 101.96000 Ingredient Quantity Nutrient Energy N_Quantity 314.00000 Units kcal Total_qty 628.00000 Ingredient Quantity Nutrient Sugars, total including NLEA N_Quantity 1.96000 Units g Total_qty 3.92000 Ingredient Quantity Nutrient Fiber, total dietary N_Quantity 2.00000 Units g Total_qty 4.00000 Ingredient Quantity Nutrient Sodium, Na N_Quantity 686.00000 Units mg Total_qty 1372.00000 Ingredient Quantity Nutrient Fatty acids, total trans N_Quantity .00000 Units g Total_qty .00000 Ingredient Broccoli, raw Quantity 200 Nutrient N_Quantity Units Total_qty Ingredient Quantity Nutrient Protein N_Quantity 2.82000 Units g Total_qty 5.64000 Ingredient Quantity Nutrient Total lipid (fat) N_Quantity .37000 Units g Total_qty .74000 Ingredient Quantity Nutrient Carbohydrate, by difference N_Quantity 6.64000 Units g Total_qty 13.28000 Ingredient Quantity Nutrient Energy N_Quantity 34.00000 Units kcal Total_qty 68.00000 Ingredient Quantity Nutrient Alcohol, ethyl N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient Water N_Quantity 89.30000 Units g Total_qty 178.60001 Ingredient Quantity Nutrient Caffeine N_Quantity .00000 Units mg Total_qty .00000 Ingredient Quantity Nutrient Theobromine N_Quantity .00000 Units mg Total_qty .00000 Ingredient Quantity Nutrient Sugars, total including NLEA N_Quantity 1.70000 Units g Total_qty 3.40000 Ingredient Quantity Nutrient Fiber, total dietary N_Quantity 2.60000 Units g Total_qty 5.20000 Ingredient Quantity Nutrient Calcium, Ca N_Quantity 47.00000 Units mg Total_qty 94.00000 Ingredient Quantity Nutrient Iron, Fe N_Quantity .73000 Units mg Total_qty 1.46000 Ingredient Quantity Nutrient Magnesium, Mg N_Quantity 21.00000 Units mg Total_qty 42.00000 Ingredient Quantity Nutrient Phosphorus, P N_Quantity 66.00000 Units mg Total_qty 132.00000 Ingredient Quantity Nutrient Potassium, K N_Quantity 316.00000 Units mg Total_qty 632.00000 Ingredient Quantity Nutrient Sodium, Na N_Quantity 33.00000 Units mg Total_qty 66.00000 Ingredient Quantity Nutrient Zinc, Zn N_Quantity .41000 Units mg Total_qty .82000 Ingredient Quantity Nutrient Copper, Cu N_Quantity .04900 Units mg Total_qty .09800 Ingredient Quantity Nutrient Selenium, Se N_Quantity 2.50000 Units µg Total_qty 5.00000 Ingredient Quantity Nutrient Retinol N_Quantity .00000 Units µg Total_qty .00000 Ingredient Quantity Nutrient Vitamin A, RAE N_Quantity 31.00000 Units µg Total_qty 62.20000 Ingredient Quantity Nutrient Carotene, beta N_Quantity 361.00000 Units µg Total_qty 722.00000 Ingredient Quantity Nutrient Carotene, alpha N_Quantity 25.00000 Units µg Total_qty 50.00000 Ingredient Quantity Nutrient Vitamin E (alpha-tocopherol) N_Quantity .78000 Units mg Total_qty 1.56000 Ingredient Quantity Nutrient Vitamin D (D2 + D3) N_Quantity .00000 Units µg Total_qty .00000 Ingredient Quantity Nutrient Cryptoxanthin, beta N_Quantity 1.00000 Units µg Total_qty 2.00000 Ingredient Quantity Nutrient Lycopene N_Quantity .00000 Units µg Total_qty .00000 Ingredient Quantity Nutrient Lutein + zeaxanthin N_Quantity 1403.00000 Units µg Total_qty 2806.00000 Ingredient Quantity Nutrient Vitamin C, total ascorbic acid N_Quantity 89.20000 Units mg Total_qty 178.39999 Ingredient Quantity Nutrient Thiamin N_Quantity .07100 Units mg Total_qty .14200 Ingredient Quantity Nutrient Riboflavin N_Quantity .11700 Units mg Total_qty .23400 Ingredient Quantity Nutrient 12:0 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient Vitamin B-6 N_Quantity .17500 Units mg Total_qty .35000 Ingredient Quantity Nutrient Folate, total N_Quantity 63.00000 Units µg Total_qty 126.00000 Ingredient Quantity Nutrient Vitamin B-12 N_Quantity .00000 Units µg Total_qty .00000 Ingredient Quantity Nutrient Choline, total N_Quantity 18.70000 Units mg Total_qty 37.40000 Ingredient Quantity Nutrient Vitamin K (phylloquinone) N_Quantity 101.60000 Units µg Total_qty 203.20000 Ingredient Quantity Nutrient Folic acid N_Quantity .00000 Units µg Total_qty .00000 Ingredient Quantity Nutrient Folate, food N_Quantity 63.00000 Units µg Total_qty 126.00000 Ingredient Quantity Nutrient Folate, DFE N_Quantity 63.00000 Units µg Total_qty 126.00000 Ingredient Quantity Nutrient Vitamin E, added N_Quantity .00000 Units mg Total_qty .00000 Ingredient Quantity Nutrient Vitamin B-12, added N_Quantity .00000 Units µg Total_qty .00000 Ingredient Quantity Nutrient Cholesterol N_Quantity .00000 Units mg Total_qty .00000 Ingredient Quantity Nutrient Fatty acids, total saturated N_Quantity .03900 Units g Total_qty .07800 Ingredient Quantity Nutrient 4:0 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 6:0 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 8:0 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 10:0 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient Niacin N_Quantity .63900 Units mg Total_qty 1.27800 Ingredient Quantity Nutrient 14:0 N_Quantity .00100 Units g Total_qty .00200 Ingredient Quantity Nutrient 16:0 N_Quantity .02900 Units g Total_qty .05800 Ingredient Quantity Nutrient 18:0 N_Quantity .00600 Units g Total_qty .01200 Ingredient Quantity Nutrient 18:1 N_Quantity .01000 Units g Total_qty .02000 Ingredient Quantity Nutrient 18:2 N_Quantity .01700 Units g Total_qty .03400 Ingredient Quantity Nutrient 16:0 N_Quantity .02900 Units mg Total_qty .05800 Ingredient Quantity Nutrient 20:4 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 22:6 n-3 (DHA) N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 16:1 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 18:4 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 20:1 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 20:5 n-3 (EPA) N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 22:1 N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient 22:5 n-3 (DPA) N_Quantity .00000 Units g Total_qty .00000 Ingredient Quantity Nutrient Fatty acids, total monounsaturated N_Quantity .01100 Units g Total_qty .02200 Ingredient Quantity Nutrient Fatty acids, total polyunsaturated N_Quantity .03800 Units g Total_qty .07600 Ingredient Quantity Nutrient N_Quantity Units Total_qty
This is the error code which may be:
This is the description of the error code which may be:
Imports System Imports System.Text imports System.Collections.Generic Imports System.Net Imports Newtonsoft.Json Public Class professional_recipe_nutrients_api Public Class ResponseFields Public Property op As New List(Of output_recipe) Public Property energy As Single Public Property cholesterol As Single Public Property calcium As Single Public Property lipids As Single Public Property carbohydrates As Single Public Property proteins As Single Public Property fibers As Single Public Property sugars As Single Public Property saturated_fatts As Single Public Property trans_fatts As Single Public Property monounsaturated_fatts As Single Public Property polyunsaturated_fatts As Single End Class Public Class output_nutrients Public Property name As String Public Property quantity As Single Public Property um As String Public Property total_qty As Single End Class Public Class output_recipe Public Property ingredient As String Public Property quantity As Single Public Property nutrient As New List(Of output_nutrients) End Class Public Class ErrorFields Public Property cd As String Public Property description As String End Class Protected Sub SendRequest() Dim Client As WebClient = New WebClient() Dim credentials As String = Convert.ToBase64String(Encoding.ASCII.GetBytes("your_username:your_password")) Client.Headers(HttpRequestHeader.Authorization) = String.Format("Basic {0}", credentials) Client.Headers(HttpRequestHeader.Accept) = "application/json" Client.Headers(HttpRequestHeader.ContentType) = "application/json" Client.BaseAddress = "https://gatiosoft.ro/nutrientizer.aspx" Dim resString As String = "" Try Dim js As String = "Replace this string with your JSON Request Body string like in the example above on the website" Dim reqString As Byte() = Encoding.UTF8.GetBytes(js) Dim url As Uri = New Uri(Client.BaseAddress) Dim resByte As Byte() = Client.UploadData(url, "post", reqString) resString = Encoding.UTF8.GetString(resByte) If resString.IndexOf("ingredient") > 0 Then Dim r As ResponseFields = New ResponseFields() r = JsonConvert.DeserializeObject(Of ResponseFields)(resString) Console.Write(resString) Else Dim e As list(of ErrorFields) = New list(of ErrorFields) e = JsonConvert.DeserializeObject(Of list(of ErrorFields))(resString) Console.Write(e(0).cd) Console.Write(e(0).description) End If Client.Dispose() Catch exception As Exception Dim ex As System.Exception = exception Console.Write("ERROR: " & resString & ex.Message) End Try End Sub Public Shared Sub Main() Dim b As professional_recipe_nutrients_api = New professional_recipe_nutrients_api b.SendRequest() End Sub End Class
Sub VBAExcelJson() Url = "https://gatiosoft.ro/nutrientizer.aspx" JsonRequestBody = "Replace this string with your JSON request string like in example above on the website" Dim JsonHttp As Object Set JsonHttp = CreateObject("Microsoft.XMLHTTP") Dim authUser As String authUser = "Your Usernmae" Dim authPass As String authPass = "Your Password" With JsonHttp .Open "POST", Url, False .SetRequestHeader "Authorization", "Basic " + EncodeBase64(authUser + ":" + authPass) .SetRequestHeader "Content_Type", "application/json" .SetRequestHeader "Accept", "application/json" .send (JsonRequestBody) End With Dim JsonResult As String JsonResult = JsonHttp.responseText Cells(1, 1).value = JsonResult End Sub Function EncodeBase64(text As String) As String Dim arrData() As Byte arrData = StrConv(text, vbFromUnicode) Dim objXML As MSXML2.DOMDocument60 Dim objNode As MSXML2.IXMLDOMElement Set objXML = New MSXML2.DOMDocument60 Set objNode = objXML.createElement("b64") objNode.DataType = "bin.base64" objNode.nodeTypedValue = arrData EncodeBase64 = Application.Clean(objNode.text) Set objNode = Nothing Set objXML = Nothing End Function
using System; using System.Collections.Generic; using System.Text; using System.Net; using Newtonsoft.Json; public class professional_recipe_nutrients_api { public class ResponseFields { public List<output_recipe> op { get; set; } public float energy { get; set; } public float cholesterol { get; set; } public float calcium { get; set; } public float lipids { get; set; } public float carbohydrates { get; set; } public float proteins { get; set; } public float fibers { get; set; } public float sugars { get; set; } public float saturated_fatts { get; set; } public float trans_fatts { get; set; } public float monounsaturated_fatts { get; set; } public float polyunsaturated_fatts { get; set; } } public class output_nutrients { public string name { get; set; } public float quantity { get; set; } public string um { get; set; } public float total_qty { get; set; } } public class output_recipe { public string ingredient { get; set; } public float quantity { get; set; } public List<output_nutrients> nutrient { get; set; } } public class ErrorFields { public string cd { get; set; } public string description { get; set; } } protected void SendRequest() { WebClient Client = new WebClient(); string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("your_username:your_password")); Client.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentials); Client.Headers[HttpRequestHeader.Accept] = "application/json"; Client.Headers[HttpRequestHeader.ContentType] = "application/json"; Client.BaseAddress = "https://gatiosoft.ro/nutrientizer.aspx"; string resString = ""; try { string js = "Replace this string with your JSON Request Body string like in the example above on the website"; byte[] reqString = Encoding.UTF8.GetBytes(js); Uri url = new Uri(Client.BaseAddress); byte[] resByte = Client.UploadData(url, "post", reqString); resString = Encoding.UTF8.GetString(resByte); if (resString.IndexOf("ingredient") > 0) { ResponseFields r = new ResponseFields(); r = JsonConvert.DeserializeObject<ResponseFields>(resString); Console.Write(resString); } else { List<ErrorFields> e = new List<ErrorFields>(); e = JsonConvert.DeserializeObject<List<ErrorFields>>(resString); Console.Write(e[0].cd); Console.Write(e[0].description); } Client.Dispose(); } catch (Exception exception) { System.Exception ex = exception; Console.Write("ERROR: " + resString + ex.Message); } } public static void Main() { professional_recipe_nutrients_api b = new professional_recipe_nutrients_api(); b.SendRequest(); } }
import java.util.Base64; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws IOException { String originalInput = "your_username:your_password"; String credentials = Base64.getEncoder().encodeToString(originalInput.getBytes()); final String POST_PARAMS = "Replace this string with your JSON request string"; URL obj = new URL("https://gatiosoft.ro/nutrientizer.aspx"); HttpURLConnection postConnection = (HttpURLConnection) obj.openConnection(); postConnection.setRequestMethod("POST"); postConnection.setRequestProperty("Authorization", "Basic " + credentials); postConnection.setRequestProperty("Content-Type", "application/json"); postConnection.setRequestProperty("Accept", "application/json"); postConnection.setDoOutput(true); OutputStream os = postConnection.getOutputStream(); os.write(POST_PARAMS.getBytes()); os.flush(); os.close(); int responseCode = postConnection.getResponseCode(); if (responseCode == 200) { //success BufferedReader in = new BufferedReader(new InputStreamReader( postConnection.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in .readLine()) != null) { response.append(inputLine); } in .close(); // print json string result System.out.println(response.toString()); } else { System.out.println("POST NOT WORKED"); } } }
<?php ob_start(); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); data_string = 'Replace this string with your JSON request string like in the example above on the website'; $username = 'your_usernmae'; $password = 'your_password'; $hash = base64_encode($username . ':' . $password); $headers = array( 'Authorization: Basic ' . $hash ); ?><!DOCTYPE html> <html lang="en"> <head> <title>Test Nutrientizer API</title> </head> <body> <?php $url = "https://gatiosoft.ro/nutrientizer.aspx"; // Where you want to post data try { $ch = curl_init(); if (FALSE === $ch) throw new Exception('failed to initialize'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); // Tell cURL you want to post something curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); // Define what you want to post curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //curl_setopt(/* ... */); $content = curl_exec($ch); $info = curl_getinfo($ch); if (FALSE === $content) throw new Exception(curl_error($ch), curl_errno($ch)); } catch(Exception $e) { trigger_error(sprintf( 'Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()), E_USER_ERROR); } echo '<pre>'; print_r($data); echo '</pre>'; echo '<br />'; echo http_build_query(array('data' => $data)); echo '<br /><br />'; $json = json_encode($data); echo "<b>JSON Request is:</b>" ."<br />" . $json . "<br />" . "<br />"; $onlyjson = str_replace("\u0022", '"', $content); echo "<br />" . "<br />" . "<b>JSON Response From API is:</b>" . "<br />" . $onlyjson . "<br />";?> </body> </html>
String URL = "https://gatiosoft.ro/nutrientizer.aspx"; String inputs = "Replace this string with your JSON request string"; JSONArray arr = new JSONArray(inputs); JsonArrayRequest req = new JsonArrayRequest(URL, arr, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { try { VolleyLog.v("Response:%n %s", response.toString(4)); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.e("Error: ", error.getMessage()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { String credentials = "username" + ":" + "password"; String base64EncodedCredentials = Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); HashMap<String, String> headers = new HashMap<>(); headers.put("Authorization", "Basic " + base64EncodedCredentials); headers.put("Content-Type", "application/json"); headers.put("Accept", "application/json"); return headers; } }; MyApplication.getInstance().addToRequestQueue(req, "headerRequest");
import Foundation import UIKit import Alamofire class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://gatiosoft.ro/nutrientizer.aspx")! // your credentials encoded in base64 let username = "Your username" let password = "Your password" let loginData = String(format: "%@:%@", username, password). data(using: String.Encoding.utf8)! let base64LoginData = loginData.base64EncodedString() let headers = ["Authorization" : "Basic \(base64LoginData)", "Content-Type": "application/json", "Accept": "application/json"] //Prepare paramsBody to send let paramsBody: [String: Any] = ["Replace this string with your JSON request string"] //Make Request Alamofire.request(url, method: .post,parameters: paramsBody, encoding: URLEncoding.default, headers: headers).responseJSON { response in print(response) //get status code if let status = response.response?.statusCode { switch(status){ case 201: print("Success") default: print("Error with response status: \(status)") } } //get JSON return value if let result = response.result.value { let JSON = result as! NSDictionary print(JSON) } } } }
import requests import json import base64 json_string = 'Replace this string with your JSON request string' data = json.loads(json_string) usrPass = b'your_username:your_password' b64Val = base64.b64encode(usrPass) b64Val = str(b64Val,'utf-8') resp = requests.post('https://gatiosoft.ro/nutrientizer.aspx', headers={"Authorization": "Basic %s" % b64Val, 'Content-Type': 'application/json', 'Accept': 'application/json'}, json=data) resp_data = resp.json() print(resp_data)
require 'uri' require 'net/https' require 'json' require 'base64' class DoHttpsRequest def call(url, json) uri = URI.parse(url) req = Net::HTTP::Post.new(uri.to_s) req.body = json.to_json req['Content-Type'] = 'application/json' req['Accept'] = 'application/json' req['Authorization'] = 'Basic ' + Base64.strict_encode64("your_username:your_password") response = https(uri).request(req) response.body end private def https(uri) Net::HTTP.new(uri.host, uri.port).tap do |http| http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE end end end url = "https://gatiosoft.ro/nutrientizer.aspx" input_json=[ { "ingredient": "wheat flour organic", "quantity": 200.0 }, { "ingredient": "broccoli raw", "quantity": 200.0 } ] puts DoHttpsRequest.new.call(url, input_json)
var request = require('request'); var auth = 'Basic ' + Buffer.from('your_username' + ':' + 'your_password').toString('base64'); var urlapi = 'https://gatiosoft.ro/nutrientizer.aspx'; request.post({ url: urlapi, headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': auth }, json: [ { "ingredient": "wheat flour organic", "quantity": 200.0 }, { "ingredient": "broccoli raw", "quantity": 200.0 } ] }, function(error, response, body) { console.log(response) } );
FUNCTION Get_Recipe_Nutrients() chttp is un httpRequest creponse is un httpResponse sPassWord is a Buffer = "your_username:your_password" Res_Encode64 is a string = Encode( sPassWord , encodeBASE64) chttp..Header["Authorization"] = "Basic "+ Res_Encode64 chttp..Header["Accept"] = "application/json" chttp..URL = "https://gatiosoft.ro/nutrientizer.aspx" chttp..Method = httpPost chttp..ContentType = "application/json" chttp.Content= [ [{ "ingredient":"wheat flour organic", "quantity":200 }, { "ingredient":"broccoli raw", "quantity":200 }] ] chttp.Content=StringToUTF8(chttp.Content) creponse = HTTPSend(chttp) IF ErrorOccurred THEN Error(ErrorInfo(errComplet)) STC_Result..Value="Error" ELSE let vReponseVariant = JSONToVariant("["+creponse.Content+"]") STC_Result..Value=creponse.Content END
<!DOCTYPE html> <html> <head> <title>Professional Recipe Nutrients API, Nutrientizer</title> </head> <body> //Put the script below before the end of body tag. <script> let url = 'https://cors-anywhere.herokuapp.com/https://gatiosoft.ro/nutrientizer.aspx'; let username = 'your_username'; let password = 'your_password'; var data = [ { "ingredient": "wheat flour organic", "quantity": 200.0 }, { "ingredient": "broccoli raw", "quantity": 200.0 } ]; var x = new XMLHttpRequest(); x.open('POST', url); x.setRequestHeader('Authorization', 'Basic ' + window.btoa(username + ":" + password)); x.setRequestHeader('Content-Type', 'application/json'); x.setRequestHeader('Accept', 'application/json'); x.onload = x.onerror = function() { if (x.status==200 && x.statusText=='OK') console.log(x.responseText); else console.log("Error"); }; x.send(JSON.stringify(data)); </script> </body> </html>
Professional Recipe Nutrition Calculator API, Nutrientizer is in the video presentation below. There are several search terms which you may use like: recipe nutrition calculator usda, nutritional analysis calculator, recipe nutrition analyzer, recipe nutritional value calculator, recipe nutrition facts calculator, food calorie calculator recipe, recipe calorie and nutrition calculator, recipe builder calorie counter, recipe calorie analyzer, recipe nutrition calculator online, find nutritional value of recipe, recipe nutritional information calculator.
Terms and Conditions | Privacy Policy | Cookies | ANPC | ANSPDCP | Contact