Edamam Food Data API Config Help Needed

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).

My sticking points are:

  1. How do I retrieve the nutritional info, rather than just a top level connection to the API.
  2. 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.

image

If anyone has any advise, I’d be very grateful.

Hey @caraldine :wave:

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:
brave_hCB4D6kAgk

Simply, the food data you are expecting is in hints:

I could show it in the repeating group by passing a value from input:

If you want to check the all editor, here it is: Bubble Demos by Flusk | Bubble Editor

I hope this gives you some starting point.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

This is great thanks. I’ve managed to get this part working now.

The next part is to parse the results of the search to request more data from their nutrients URL. I have set up the API as follows:

And I can connect and get a response using Postman, so I’m not sure why I am getting this error in Bubble.

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.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

I’m using static data. I’m just trying to initialise the POST Call. The GET call initializes ok. But the POST call gives the error 401

Here is same request using Postman with same static data

I have also tried importing the working cURL generated from Postman and this still generates a 401 error.

Hi @caraldine,

Do you have the API documentation by chance?

Hey @caraldine :wave:

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.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

wow - thank you so much. I have it initialised now. :pray:

1 Like