How to lookup a Barcode Value and return Product Data in C# .NET Framework

Cloudmersive
1 min readMar 26, 2020

--

Judicious use of our barcode API will take all the difficulty out of setting up a barcode lookup system in C#. Let’s get straight to the method.

We need to install our API client using NuGet with this command, which can be run from the package manager console.

Install-Package Cloudmersive.APIClient.NET.Barcode -Version 2.0.2

Following that, run the barcode lookup function, see below:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.Barcode.Api;using Cloudmersive.APIClient.NET.Barcode.Client;using Cloudmersive.APIClient.NET.Barcode.Model;namespace Example{public class BarcodeLookupEanLookupExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new BarcodeLookupApi();var value = value_example;  // string | Barcode valuetry{// Lookup a barcode value and return product dataBarcodeLookupResponse result = apiInstance.BarcodeLookupEanLookup(value);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling BarcodeLookupApi.BarcodeLookupEanLookup: " + e.Message );}}}}

Enter your target barcode as a string and the API will return your product data for you. Simple, wouldn’t you say? This same barcode API allows the creation barcodes as well, with support for many popular formats including EAN-8 and QR.

--

--

Cloudmersive

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