Recipe - Food - Nutrition

ÜCRETSİZ PREMIUM
Verified
Taraf David | Güncelleyen 한 달 전 | Food
Popülerlik

9.9 / 10

Gecikme

1,485ms

Hizmet Düzeyi

100%

Health Check

N/A

Tüm Tartışmalara Dön

Error 404 for get request of recipe information

Rapid account: Parynaz
parynaz
7년 전

I get an error when I try to do a get request for recipe information using the id. I’m not sure what is wrong here, because it goes through but returns an error. I even tried to change the curly braces on the id to %7B and %7D but it didn’t work either. Thanks

return $http.get(“https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/{id}/information”,
{params: {‘id’ : id, ‘includeNutrition’: true }}).then(
function(payload) {
var recipes = payload.data;
return recipes;
},

Rapid account: Parynaz
parynaz Commented 7년 전

Thank you. The problem was that the parameter for id was in the middle of the url so I just did this instead and it worked (for anyone else who has the same problem)

		details: function(id) {return $http.get("https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/" + id + "/information", {params: {'includeNutrition': true }}).then(
			function(information) {
				var details = information.data;
				return details;
Rapid account: Spoonacular
spoonacular Commented 7년 전

Hey parynaz, curly braces mean that this is a parameter and needs to be replaced. So to get information for the recipe with id 1234 you have to call …/recipes/1234/information

Aşağıya yorum ekleyerek tartışmaya katılın:

Yeni yorumlar göndermek için giriş yapın / kaydolun