Logging with a Barcode
The process to to log a meal with a barcode requires the following steps.
Searching By Barcode
Below is an example of searching by barcode by all types. To search by a specific type of barcode like UPC-8 or GTIN-13 see the the products_search_list operation.
curl -X GET 'https://api-beta.bite.ai/products/ids/?barcode=73124005084'
The response includes the nutritional details for the item.
{"count": 1,"next": null,"previous": null,"results": [{"id": "37c14da3-18c9-4e0a-9ec8-596d2262cc29","name": "Hearth Baked Pitettes Pita Bread Classic White","details": null,"description": null,"brand": {"id": "d61f1d38-5ab2-4e86-b425-af7d58c21ed6","name": "Toufayan Bakery Inc"},"type": "pp","text_ingredients": "ENRICHED WHEAT FLOUR [CONTAINS NIACIN, REDUCED IRON, THIAMINE MONONITRATE (VITAMIN B1), RIBOFLAVIN (VITAMIN B2), FOLIC ACID], WATER, YEAST, CONTAINS LESS THAN 2% OF EACH OF THE FOLLOWING: SUGAR, SALT, CALCIUM PROPIONATE (ADDED TO MAINTAIN FRESHNESS).","ingredients": [],"nutrition_facts": [{"id": "3599556d-fb5e-445b-b0fb-28842bc01e0d","item": "37c14da3-18c9-4e0a-9ec8-596d2262cc29","serving": {"amount": 1,"unit": {"id": "a679e5d8-908c-419a-b52a-b8e27be7df29","singular_name": "loaf","abbreviated_singular_name": null,"plural_name": "loaves","abbreviated_plural_name": null,"measure_type": null,"granularity": 0.125,"details": null},"grams": 28},"servings_per_package": null,"nutrition": {"calories": 80,"total_fat": 0,"saturated_fat": 0,"trans_fat": 0,"total_carb": 15,"sugars": 1,"fiber": 1,"protein": 3,"cholesterol": 0,"sodium": 120,"calcium": 20,"iron": 3.54,"vitamin_a_iu": 0,"vitamin_c": 0},"is_default": true}],"is_generic": false,"categorizations": {}}]}
The item name should be displayed to the user to ensure it’s the item they scanned.