Sign in | Sign up

Brand Name List

Tagged:

Currently contains 15 posts

Avatar

November 05, 2013 05:30

Totaltrainer1

how to get all brand list?

November 05, 2013 15:45

Anonymous User

Use `/v1_1/brand/search`

the `offset` and `limit` params allow you to page through all if you do not supply a `query`
and set `auto` to false

https://developer.nutritionix.com/docs/v1_1

Avatar

November 24, 2013 20:38

rob@her01c.com

I cannot get this to work. Always returns an empty result set. Can you please verify?

Avatar

November 25, 2013 18:07

rob@her01c.com

More specifically, I’m looking to get a list of all restaurant brands only.

November 27, 2013 01:52

Anonymous User

This is a working URL, just replace your credentials in the query string.

https://api.nutritionix.com/v1_1/brand/search?appId=YOUR_APP_ID&appKey=YOUR_APP_KEY&auto=false&limit=50&min_score=0.1&offset=0&type=1

- appId
- appKey
- auto = false (autocomplete)
- limit = 50 (Max results per page)
- offset = 0 (Starting point for pagination)
- min_score = 0.1 (All matches even if they score low)
- type = 1 (Only Restaurant Brands)

Let me know if this solves your problem, and what (if anything) was confusing about the documentation so I can make notes.

Avatar

December 06, 2013 15:27

robb18

I’m getting a “404 Not Found” when I try to get from https://api.nutritionix.com/v1_1/brand/search with the following parameters:

“appId”:“YOUR_APP_ID”,
“appKey”:“YOUR_APP_KEY”
“query”:“subway”
min_score
type

Not sure what I am doing wrong. I am trying to get the brand_id for Subway Restaurants.

Rob

December 06, 2013 15:35

Anonymous User

I cant do much without an entire curl output of what your doing.

URL
HEADERS
METHOD
BODY

but from the sound of it you are sending a POST request. That endpoint only accepts GET requests. Those params must be query string parameters. Not a JSON formatted POST body.

Avatar

December 06, 2013 16:20

robb18

URL: https://api.nutritionix.com/v1_1/brand/search?query=subway&type=1&min_score=1&appId=YOUR_APP_ID&appKey=YOUR_APP_KEY

Response:

status code: 500, headers {
“Access-Control-Allow-Headers” = “Content-Type, X-Requested-With”;
“Access-Control-Allow-Methods” = “GET, PUT, POST, DELETE, OPTIONS”;
“Access-Control-Allow-Origin” = “*”;
Connection = “keep-alive”;
“Content-Length” = 1607;
“Content-Type” = “application/json; charset=utf-8”;
Date = “Fri, 06 Dec 2013 16:10:16 GMT”;
Etag = “\”1335660265\"";
Server = “nginx/1.4.4 + Phusion Passenger 4.0.25”;
Status = “500 Internal Server Error”;
“X-Powered-By” = “Express, Phusion Passenger 4.0.25”;

resultsDictionary:
“_id” = 52a1f6e9cedb0e9050001fbd;
“error_message” = “Error: invalid json”;
message = “Questions? Reference this errors ‘_id’ on the Nutritionix Forum. https://developer.nutritionix.com/forum”;
recommendations = “Check your Request Details. You may have incorrectly used some params, or the request was malformed.”;
“req_info” = {
“_parsedUrl” = {
auth = “<null>”;
hash = “<null>”;
host = “<null>”;
hostname = “<null>”;
href = “/v1_1/brand/search?query=subway&type=1&min_score=1&appId=YOUR_APP_ID&appKey=YOUR_APP_KEY”;
path = “/v1_1/brand/search?query=subway&type=1&min_score=1&appId=YOUR_APP_ID&appKey=YOUR_APP_KEY”;
pathname = “/v1_1/brand/search”;
port = “<null>”;
protocol = “<null>”;
query = “query=subway&type=1&min_score=1&appId=YOUR_APP_ID&appKey=YOUR_APP_KEY”;
search = “?query=subway&type=1&min_score=1&appId=YOUR_APP_ID&appKey=YOUR_APP_KEY”;
slashes = “<null>”;
};
appId = YOUR_APP_ID;
appKey = YOUR_APP_KEY;
body = {
};
files = “<null>”;
headers = {
accept = “application/json”;
“accept-encoding” = “gzip, deflate”;
“accept-language” = “en-us”;
connection = “keep-alive”;
“content-type” = “application/json”;
cookie = “4997bb88c66fd8216e0105784eb0fde299c24f93=s%3AeesSbn48Nvz8%2FDR51gN0hlQx.ifHxbnhA%2FxV%2F416E2hyKNFsRhJ9%2BUYemTGHW%2BcXu2Tg”;
host = “api.nutritionix.com”;
“user-agent” = “Viands/1.0 CFNetwork/672.0.8 Darwin/13.0.0”;
“x-forwarded-for” = “174.100.64.217”;
“x-forwarded-port” = 443;
“x-forwarded-proto” = https;
};
method = GET;
query = {
appId = YOUR_APP_ID;
appKey = YOUR_APP_KEY;
“min_score” = 1;
query = subway;
type = 1;
};
remoteAddress = “127.0.0.1”;
};

December 06, 2013 16:49

Anonymous User

Okay, you need to send that as CURL -XGET, and remove the Content-Type: application/json header.

Avatar

December 06, 2013 18:42

robb18

Got it.

Thanks,

Rob

December 06, 2013 18:52

Anonymous User

No problem. Hopefully that solved the issue. Let me know if there was anything else. Maybe something we should update in the documentation to make things more clear?

Avatar

November 20, 2014 13:29

manojkumar

The main issue is that OFFSET or any other parameters like TYPE are not being entertained by brand search api if we are hitting it with QUERY parameter EMPTY. It just shows the first 50 records in every case. The result is same whether you are setting a different offset or you are changing any TYPE. Please look into this as I just want listing for both restaurants and foods.

Thanks

Avatar

November 20, 2014 14:19

Matt Silverman

We are creating an engineering ticket to look into this further. Thanks!

November 24, 2014 14:45

Anonymous User

The `offset` parameter does not represent a page but the position of the cursor in the result set. You need to increment the `offset` by the `limit` to view each page.

Example:
Page 1 = limit 50 offset 0
Page 2 = limit 50 offset 50
Page 3 = limit 50 offset 100
etc…

There is no need to supply `min_score` since they will all have a score of 1 without a query, and `auto` may be omitted as well.

Here is an example curl request to page through all restaurant brands (type 1)

curl -X GET https://api.nutritionix.com/v1_1/brand/search?appId=YOUR_APP_ID&appKey=YOUR_APP_KEY&limit=50&offset=0&type=1

November 24, 2014 14:49

Anonymous User

If you want a list of all brands don’t supply the `type` parameter and use the `limit` and `offset` to page through the results.

Reply to thread