How to lookup a Barcode Value and return Product Data in Node.JS

This tutorial will go over the use of an API to handle obtaining product data from barcodes in Node.JS.

We are going to start out with our installation, handled with npm install.

npm install cloudmersive-barcodeapi-client --save

Now call our function with this code here:

var CloudmersiveBarcodeapiClient = require('cloudmersive-barcodeapi-client');var defaultClient = CloudmersiveBarcodeapiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveBarcodeapiClient.BarcodeLookupApi();var value = "value_example"; // String | Barcode valuevar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.barcodeLookupEanLookup(value, callback);

Enter the barcode value as a string and you will be given back your product data via the API. Why don’t you take a moment and think about how much time you just saved. You’re welcome.

Image for post
Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store