Nutrition API - Mobile SDK interoperability
Last updated
Last updated
Mobile SDK: searchForFoodSemantic
API: https://api.passiolife.com/v2/products/food/search/semantic?term=$query
or
Mobile SDK: searchForFood
API: https://api.passiolife.com/v2/products/food/search/advanced?term=$query
The SDK adds the Localization-ISO
header to the request if the locale code was set using the function updateLanguage
The API response provides two JSON arrays: search responses and alternate names (suggestions)
The search responses JSON is mapped to a PassioFoodDataInfo
object using mapping
MobileSDK: recognizeImageRemote
API: https://api.passiolife.com/v2/products/sdk/tools/vision/extractIngredients
The SDK actually executes several steps before sending the request to the aforementioned API, which include barcode scanning, and OCR for nutrition facts recognition
If the SDK did not detect a barcode or nutrition facts in the image, it will proceed with the preparation of the request
The body of the request will contain a base64 encoded string of the native image
The SDK adds the Localization-ISO
header to the request if the locale code was set using the function updateLanguage
The successful response is mapped to a list of PassioAdvisorFoodInfo
objects, using mapping
MobileSDK: recognizeSpeechRemote
API: https://api.passiolife.com/v2/products/sdk/tools/extractMealLogAction
The body contains the plain text passed as an argument to the recognizeSpeechRemote function
The SDK adds the Localization-ISO
header to the request if the locale code was set using the function updateLanguage
MobileSDK: fetchFoodItemForRefCode
API: https://api.passiolife.com/v2/products/food/search/result/refCode/$refCode
The response contains the same JSON as the Food searchresponse, but here the alternatives field is not parsed, and the response will only contain one result in the JSON array
The refCode is also parsed for extracting the boolean variable called shortName
MobileSDK: fetchFoodItemForProductCode
API: https://api.passiolife.com/v2/products/food/productCode/$upcCode?metadata=$encoded
The SDK adds the Localization-ISO
header to the request if the locale code was set using the function updateLanguage
The successful response is mapped to a list of PassioSpeechRecognitionModel
objects, using mapping
That result is parsed as a PassioFoodItem object, using mapping
The SDK will add the encoded metadata into the url of the request. The metadata contains a boolean key called shortName, used in the
That result is parsed as a PassioFoodItem object, using mapping