Grocy: Barcode lookup via online database

Created on 19 Apr 2018  路  3Comments  路  Source: grocy/grocy

To add a product it would be useful to only need the barcode.
grocy could look into different online "barcode to product" databases, like http://opengtindb.org to get all neccesary information.

enhancement

Most helpful comment

Yes, it would better to establish a modular way.
The API of opengtindb.org is not free, right. But all datasets are licensed under GNU. Some times ago i build a wrapper for this website to extract all neccesarry data out of the source code.
If you provice a plugin api for grocy, i would create a plugin for opengtindb.org.

Edit: https://github.com/gruessung/IntelliFridge/blob/master/eanApi.php

All 3 comments

It seems that the API of opengtindb.org is not free and also only available for commercial purposes.
When doing this, it would be best to do it in an "plugin like" way, not hardcode to a specific service...

The information to get would be currently only the name and the quantity unit (would need a mapping to own quantity units).

When the major bunch of products are added to the database, from my personal experience with grocy in nearly 1 year daily use, it's not a big problem:

  • I keep generic named products only in my database (means for example I only have "Chocolate", although I buy it from different brands)
  • To a product multiple barcodes can be assigned (different brands of chocolate...)
  • Assigning unknown barcodes and creating products can be directly done in a kind of "workflow" during purchase scanning (a popup appears when you leave the product input field when something unknown was entered)

Yes, it would better to establish a modular way.
The API of opengtindb.org is not free, right. But all datasets are licensed under GNU. Some times ago i build a wrapper for this website to extract all neccesarry data out of the source code.
If you provice a plugin api for grocy, i would create a plugin for opengtindb.org.

Edit: https://github.com/gruessung/IntelliFridge/blob/master/eanApi.php

This is now also done - I added a kind of plugin like system to lookup products by barcodes, see the reference implementation of such a plugin in data/plugins/DemoBarcodeLookupPlugin.php

In short:
Via the REST API at /api/stock/external-barcode-lookup/123456 products can be looked up by barcode via the configured plugin.

Additionally when also ?add=true is provided, on a successful lookup the product is also added to the database and in the output the new product id is included.

Direct link to the API documentation: https://demo-en.grocy.info/api#/Stock/get_stock_external_barcode_lookup__barcode_

Maybe this works for you...

:)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cavebeat picture cavebeat  路  5Comments

isabellaalstrom picture isabellaalstrom  路  3Comments

dbxx picture dbxx  路  3Comments

OmgImAlexis picture OmgImAlexis  路  4Comments

CorneliousJD picture CorneliousJD  路  4Comments