Hi. I am trying to create an app where a user enters and ingredient and the ingredient is added to a list. When the ingredient is added I want to fetch nutritional info for the ingredient (calories, protein, fats, and carbs). I tried coding this process but it didn't work. I am a beginner to MIT app inventor. I would greatly appreciate any help. I think the problem is in the web 1 Got Text block.
For starters, capture the responseContent in a Do It bubble, copy it, and paste into a board post.
Also, export and post your .aia for testing.
First impression of oyur parsing attempts:
Use create empty list as the default return if you are expecting a list, not blank text.
Also, post a link to the site's API docs.
P.S. Google is our friend:
https://fdc.nal.usda.gov/api-guide.html
Here's a JSON browser primed to a sample query for that site.
Customize it to match your query, and use it to get your path information.
webjson_usda_nal.aia (6.1 KB)
One last note about your query URL:
You need to change blanks in food names to %20, either by text replace or by use of the Web URIEncode block.