Recipe - Food - Nutrition

FREEMIUM
Verified
От David | Обновлено il y a 25 jours | Food
Популярность

9.9 / 10

Задержка

1,479ms

Уровень обслуживания

100%

Health Check

N/A

Назад ко всем обсуждениям

Error 404 for get request of recipe information

Rapid account: Parynaz
parynaz
il y a 7 ans

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 il y a 7 ans

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 il y a 7 ans

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

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии