Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barcode lookup via online database #6

Closed
gruessung opened this issue Apr 19, 2018 · 3 comments
Closed

Barcode lookup via online database #6

gruessung opened this issue Apr 19, 2018 · 3 comments

Comments

@gruessung
Copy link

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.

@berrnd berrnd changed the title Feature Request: Barcode to product over external database Barcode lookup via online database Apr 19, 2018
@berrnd
Copy link
Member

berrnd commented Apr 19, 2018

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)

@gruessung
Copy link
Author

gruessung commented Apr 20, 2018

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

@gruessung gruessung mentioned this issue Apr 20, 2018
berrnd added a commit that referenced this issue Apr 22, 2018
@berrnd
Copy link
Member

berrnd commented Apr 22, 2018

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...

:)

@berrnd berrnd closed this as completed Apr 22, 2018
@ghost ghost mentioned this issue Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants