#barcode #validation #gtin #upc #ean

eansearch

Search the EAN barcode database at Ean-Search.org. Search for products by EAN number or product name, verify barcodes or generate barcode images

3 stable releases

new 1.0.2 Apr 22, 2024
1.0.1 Aug 15, 2023
1.0.0 Aug 1, 2023

#581 in Database interfaces

Download history 2/week @ 2024-02-14 9/week @ 2024-02-21 4/week @ 2024-02-28 3/week @ 2024-03-13 18/week @ 2024-03-27 21/week @ 2024-04-03 40/week @ 2024-04-17

79 downloads per month

MIT/Apache

23KB
401 lines

EANSearch

Search for products by EAN barcode or product name / keywords

Features

  • Search by EAN code
  • Lookup by ISBN code (ISBN-10 or ISBN-13)
  • Search by name or keyords
  • restrict search by product category
  • get the issuing country for the barcode
  • verify barcode checksum
  • get PNG image for the EAN barcode

How to use

// search by EAN barcode, product name in English
let eansearch = EANSearch::new(&token);
let product = eansearch.barcode_lookup(5099750442227, Some(1));
let product = product.unwrap(); // unwrap result
let product = product.unwrap();
println!("EAN {} is {}", product.ean, product.name);

// search by ISBN code
let eansearch = EANSearch::new(&token);
let book = eansearch.isbn_lookup(1119578884);
let book = book.unwrap(); // unwrap result
let book = book.unwrap();
println!("ISBN-13 {} is {}", book.ean, book.name);

// now find all products with the keyword 'bananaboat'
let product_list = eansearch.product_search("bananaboat", Some(1), None);
for p in &product_list.unwrap() {
	println!("EAN {:0>13} is {} ({})", p.ean, p.name, p.category_name);
}

// only find 'bananaboat' products from the 'Music' category
let product_list = eansearch.category_search(45, Some("bananaboat"), Some(1), None);

// download a EANs that start with 509975044xxx
let product_list = eansearch.barcode_prefix_search(509975044, Some(1), None);

// find the country where a barcode was issued
let country_lookup = eansearch.issuing_country(5099750442227);

// check if this is really a valid barcode
let checksum_ok = eansearch.verify_checksum(5099750442227);

// get A PNG image of the barcode to display eg. on a website
let img = eansearch.barcode_image(5099750442227, None, None);

To use the library, you need an account and obtain an API token.

See https://www.ean-search.org/ean-database-api.html

Dependencies

~5–19MB
~271K SLoC