Recipe - Food - Nutrition

फ्रीमियम
Verified
द्वारा David | अपडेट किया गया 24日前 | Food
लोकप्रियता

9.9 / 10

लेटेंसी

1,410ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Can I pass in empty values for complex search?

Rapid account: Parynaz
parynaz
7 years ago

I have a function that will run the complex search with diet, calories, fat, protein, carbs, intolerances, type and cuisine in the http.get that will input the filter values if they are selected but ideally runs even without them being filled in.

return $http.get(“https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/searchComplex?addRecipeInformation=false”,
{params: {‘cuisine’ : cuisine, ‘diet’ : diet, ‘intolerances’: allergy, ‘maxCalories’: calMax, ‘maxCarbs’: carbMax, ‘maxFat’: fatMax, ‘maxProtein’: proteinMax, ‘minCalories’: calMin, ‘minCarbs’: carbMin, ‘minFat’: fatMin, ‘minProtein’: proteinMin, ‘query’: query, ‘type’: kind }}).then(
function(payload) {
var recipes = payload.data;
return recipes;
}

Is this possible? I ran it once with the diet parameter being empty and it worked but now it doesn’t so I’m wondering if certain ones (except query) are mandatory to be filled in. Thanks!

Rapid account: Spoonacular
spoonacular Commented 7 years ago

Hi, yes you can definitely leave out values, there are defaults for every field, so without seeing what your values actually are I can’t tell you why it didn’t work but it is possible and should work.

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें