Skip to content

Latest commit

 

History

History
81 lines (66 loc) · 2.69 KB

File metadata and controls

81 lines (66 loc) · 2.69 KB

cpp-eansearch — EAN, GTIN, UPC and ISBN lookup

A C++ class for EAN, GTIN, UPC and ISBN lookup and validation using the API at ean-search.org.

Core implementation:

Primary classes and types

Main public methods on EANSearch

Sample code

 ...
 auto * eansearch = new EANSearch(token);
 ProductFull * p = eansearch->BarcodeLookup("5099750442227");
 if (p) {
 	cout << ean << " is " << p->name << endl;
 }
 ...
 ProductList * pl = eansearch->ProductSearch("Bananaboat");
 ...

See example.cpp for more details on all API functions.

Compiling

To compile, you need Boost and OpenSSL installed.

On Debian and Ubuntu:

 sudo apt install libssl-dev boost-dev

On Windows with vcpgk

 vcpkg install openssl boost --triplet x32-windows

Build and run the example (Linux):

c++ example.o -o example -lssl -lcrypto
./example

Please note that the library is "header-only", so all code is included in the one heade file, but you will have to link with OpenSSL (for the https support).

Running the example

Export your API token as an environment variable:

export EAN_SEARCH_API_TOKEN=your_token_here