I am currently trying to learn rest APIs. I want to program a food app and I'm using the Edamam food database. https://developer.edamam.com/food-database-api-docs
If I do a request on the browser with a sample link:
Then I also get a response and all the data in JSON format.
But in Flutter I only get an error and no data output.
The code:
getFoods(String query) async { String url = "api.edamam.com";
var response = await http.get(Uri.https("api.edamam.com",
"/api/food-database/v2/parser?app_id=$appID&app_key=$appKey&ingr=$query&nutrition-type=cooking"));
print(response.body); //Output{"status" : "error", "message" : null }
}
What am I doing wrong?
I think the problem is the second parameter in Uri.https()? i don't know what should go in there