Products API Overview


#1

The Nuwe Products API provides access to food items that are Consumer Pre-packaged Goods (CPG). They are normally identified via a UPC product code, for instance, via a barcode scan.

Nuwe operates it’s own small UPC product database, typically useful for initial development to get a feel for the structure of the data and the nature of the integration into your app. But, as a small dataset, you’ll soon hit your limits.

So, then you go searching around for additional data sets, such as the Factual Consumer Goods data, SimpleUPC or Nutritionix. None of these databases are complete, none of them are practically relevant for all markets and all end users. So you end up managing integrations with 4 or 5 services, standardising the data formats and managing which results to present to your users.

That’s where the Nuwe Services come in. With a flick of a switch in your Apps settings, you can access additional data sets from a single endpoint. Nuwe handles the laborious process of managing the integrations, normalising the data and deciding which data is most appropriate to show (based on the latency of the request, availability, quality and relevancy of the data).

Currently, you can access more than 300,000 CPG items, of which, 150,000 contain nutritional data via the Factual service and we have more service integrations coming in the pipeline.

Each Service will be subject to its own terms, depending largely on the 3rd party’s own rules.

Some services will be bundled into your Nuwe Platform subscription. Others will require supplements to be added to your base subscription. In other cases, such as Factual, you will own the Factual account and will just drop your Factual API credentials into the Nuwe Service and we’ll make the requests on your behalf.

Factual’s free tier allows you 500 requests per day with a burst limit of 100 requests. Their initial paid plan starts at around $400 per month for CPG & Nutrition, which ups the daily request limit to 200,000 requests.

You can get started with this today in the Nuwe Developer Platform.


#2

@lucas_simmons said:

I also noticed in the Factual call there isn’t any data returned for cholesterol.

Also there is no data for total fat, just saturated and unsaturated. Wondering if it is possible to include total fat and cholesterol in all the results (not just for factual)? This is UPC 844334003678


#3

For now, I’d rather not, but instead if you need Total Fat, you have the data to make that easily enough in the client.

Cholesterol is provided in the /ingredients endpoint already. See:

"lipids":
            {
              "fatty_acids_total_saturated": "0.698",
              "fatty_acids_total_monounsaturated": "0.153",
              "fattty_acids_total_polyunsaturated": "0.337",
              **"cholesterol": "0"**
            },

For Factual, and Product services in general, I suggest we also provide the raw Service response as well as the normalised data which is based on the dependencies in the Nuwe eat tracking feature - see and comment on this Card to track progress.


#4

@lucas_simmons said:

What I was looking for was the ingredients list for Factual items, is that still in the works?

Please to say that this is now in the main response body. See the Docs

"ingredients":
    ["Filtered Water", "High Fructose Corn Syrup", "Pear Juice Concentrate", "Apple Juice Concentrate", "Peach Puree Concentrate", "Citric Acid", "Natural Flavors", "Ascorbic Acid (Vitamin C)"],

#5

Doritos search… not seeing ingredients but they are there in Factual. Did another one and didn’t see it


#6

That’s unfortunate on the total fat. Maybe I am missing something but, I don’t see a way to total up fats that equal the total fat.

We’d obviously prefer to stick with the Nuwe data structure, so having this data for cholesterol and fat would be helpful…


#7

Can you try again with a fresh ingredient? Can you paste your response in here?


#8

No ingredients and note how the fats total 1, but total grams of fat at http://www.factual.com/66533a8d-26e3-46b7-bbb8-e5cf5e5234d8 is 8


#9

Sorry, I should have said. Can you try again with another item that’s not the old faithful Doritos!

From earlier searches there’s an outdated version in the local DB, sans ingredients.

Try a few others to be sure and see what you get.


#10

@Retrosteve Ok, that is working but I am still confused on total fat. The fats listed in the Nuwe API do not total up to the actual total fats in products…


#11

@lucas_simmons for the Total_Fats and Cholesterol data in Products my suggestion for now is that we include this via a raw field in the response body. This will contain an array of data providers (e.g. Factual, SimpleUPC) whereby you can select the services raw data, rather than the pre-filtered set of attributes Nuwe makes available. That way you have flexibility.

Something like this will be inside the main response body, alongside the existing data:

"raw" : [
	"factual" : {
		"factual_id" : "53b38755-ad6d-4974-9c55-b03e9ea732dc",
		"brand" : "Milk Bone",
		"product_name" : "Mar-o-snacks",
		"size" : "24 oz",
		"upc" : "079100702107",
                ...
                "total_fat" : "4"
		...
	},
	"simpleupc" : {

	}
]

Again, this is scheduled for completion during July. You can track progress here


#12

@jason @lucas_simmons

Original customer support request:

The reason I am reaching out is we have started noticing some very inconsistent results using the barcode/upc scanning. Below are some details where Factual has the data, however we are getting 500s from your endpoint.

curl "https://api.nuapi.co/v3/products/602652171130.json" \

-H “Content-Type: application/json”
-H “Authorization: application_id APP_ID, client_secret CLIENT_SECRET”

get a response

run this

curl "https://api.nuapi.co/v3/products/048121207069.json" \

-H “Content-Type: application/json”
-H “Authorization: application_id APP_ID, client_secret CLIENT_SECRET”

get {“status”:“500”,“error”:“Internal Server Error”}

so getting a 500 error from their server means something is wrong on their side

  1. French’s Yellow Mustard:  https://www.factual.com/data/t/products-cpg-nutrition#q=041500000251
    
  1. Oroweat Hamburger Buns: https://www.factual.com/data/t/products-cpg-nutrition#q=073130030575
    
  1. Thomas’s English Muffins Blueberry: https://www.factual.com/data/t/products-cpg-nutrition#q=048121207069
    
  1. Blue Diamond Vanilla Almond Milk:  https://www.factual.com/data/t/products-cpg-nutrition#q=041570054161
    

On investigation we’ve found that Factual had changed the API without bumping their API version :sob:

Their old API response format from end of 2014 was:

"size":["64 fl oz"]

which has now been changed to:

"unit_weight":"64 fl oz"

Since we used to check for the first item in the array, and now there’s just a string with a new key, the server would return an error.

This has now been fixed, please give it a try…


#13

@Retrosteve working great! Many thanks!