Sign in | Sign up

Query from Doc page not working

Tagged:

Currently contains 2 posts

Avatar

October 24, 2014 17:52

mpeloso

HI, I input params into the fields of the search page and I am not getting back any results.
curl -v -X GET “https://api.nutritionix.com/v1_1/search/?brand_id=Mcdonalds&results=0%3A20&cal_min=0&cal_max=50000&fields=item_name%2Cbrand_name%2Citem_id%2Cbrand_id%2Cnf_protein&appId=myappid&appKey=mysecretcode”
I do get back a 200 and some Json response is :
{
“total_hits”: 0,
“max_score”: null,
“hits”: []
}

Avatar

October 24, 2014 18:23

Matt Silverman

The brand_id field needs to be the Nutritionix brand ID for McDonald’s. If you want to restrict to a search within that brand name, you need to do a POST query like this:
Search the documentation page for this:
“Custom Multi Field Search”

{
“appId”:“YOUR_APP_ID”,
“appKey”:“YOU_APP_KEY”,
“queries”:{
“item_name”:“Kids Fries”,
“brand_name”:“McDonalds”
}
}

Reply to thread