I’m trying to connect to Edamam’s Food Database so I can retrieve data on the Food Name, Calories, Carbs, Sugar, Protein, Fats, Salt, Sodium and Fiber content per 100g of food product.
I am new to API’s and I think I have the initial part set up correctly. But I get a feeling there is a part 2 action needed to join the Food Items with their nutritional values. This is my config to connect and I’ve included the ‘ingr’ as a search parameter, and the csfoodsearch value will be from a Custom Stat on an input box from the user. (If I have understood this correctly so far).
How do I retrieve the nutritional info, rather than just a top level connection to the API.
How do I then get the data to present back to the end user?
At present I cannot create a Group with the data to display because the API is only retrieving the main fields. So I need to somehow connect at another level for the rest of the fields.
You are doing it correctly. Just uncheck the private checkbox next to the ingr parameter and you can set this parameter in your Bubble page. See the demo below:
Simply, the food data you are expecting is in hints:
I’m using static data for an apple in order to initialise the call before converting to dynamic data. This is the FoodID I’m using for the static initialisation:-
If dynamic data is not working as expected, make sure you pass them correctly. Maybe it doesnt print the ID or other fields not correctly displayed. Also, maybe show your dynamic api setup, so I can give it a look.
I think the problem is with the shared parameters for these post and get calls: app_id and app_key.
They should be query strings like you do in Postman, but Bubble probably doesn’t set them query strings automatically when you add them to shared parameters for all calls.
When I added these to the POST call directly and set them as queryst, they worked.