Barcode lookups for games, books, CDs
I am looking to write my own media library and was wondering are there any free .Net APIs out there to identify a product based on a given barcode? As a secondary point are there .Net APIs to return cover art for books, CD, games etc based开发者_运维问答 on a barcode.
You can also use amazon web services for this. You'll need to have an account and API key (free) and download the toolkit for Visual Studio.
To answer your specific question, a barcode scan returns a UPC. You can use the ItemLookup
command for the Amazon web service for this lookup, setting the IdType
to "UPC" and the ItemId
to the appropriate UPC (barcode scan).
For more info, navigate to the "API reference" in Amazon's developer guide.
Here is a very basic C# code sample:
com.amazon.webservices.ItemLookup itemLookup = new com.amazon.webservices.ItemLookup();
itemLookup.AWSAccessKeyId = "XXXXXXXXXXXXXXXXXXXXXX";
com.amazon.webservices.ItemLookupRequest request = new com.amazon.webservices.ItemLookupRequest();
request.IdType = com.amazon.webservices.ItemLookupRequestIdType.UPC;
request.ItemId = new String[] { "00028000133177" };
request.ResponseGroup = new String[] { "Small", "AlternateVersions" };
itemLookup.Request = new com.amazon.webservices.ItemLookupRequest[] { request };
try
{
com.amazon.webservices.ItemLookupResponse itemLookupResponse = com.amazon.webservices.AWSECommerceService.ItemLookup(itemLookup);
com.amazon.webservices.Item item = itemLookupResponse.Items[0].Item[0];
System.Console.WriteLine(item.ItemAttributes.Title);
}
catch (Exception e)
{
System.Console.Error.WriteLine(e);
}
Of note, I've written a program to do exactly this. I've found that Amazon does not always have a match for every UPC (which is expected), but a majority of my items are found in Amazon. Once you do find a match, you may want to store the ASIN / UPC relationship somewhere, so that you can reference the item by the ASIN (Amazon ID) going forward.
Try this: http://www.ozgrid.com/barcodes/barcode-reader.htm
EDIT1: An API for the www.upcdatabase.com Barcode Query: http://www.upcdatabase.com/xmlrpc.asp I cannot provide much information about this, but this might help you. This page has C# VB APIs for querying with a Barcode.
Hooked In Motion has one: http://www.hookedinmotion.com/?page_id=246
精彩评论