Find eBay Product match by Title Find the answer to your question
Advanced Search Product -Select Product- GDPR Trading API Shopping API Merchandising API Feedback API Finding API Product Services Sandbox Others MIP Media API Notification API Identity API Charity API Taxonomy API Catalog API Recommendation API Compliance API Logistics API Finances API(Alpha) Negotiation API Sell Feed API Marketing Ads API Account API Inventory API Fulfillment API Marketing Promotion API Analytics API Metadata API Offer API Marketplace Insights API Deal API Marketing API Feed API Browse API Order API Analytics API Key Management API Cancellation API Case Management API Inquiry API Return API Category -Select- Getting Started Sample Code Troubleshooting HowTo's / Best Practices No Value
Language -Select- C# Flex Java JavaScript PHP VB.NET VB6
Format -Select- All XML SOAP JSON Name Value N/A
SDK -Select- .NET Java JavaScript Flax/Flash Mobile - iOS None
Sort by Default Summary New Description Date Updated
Sort order Descending Ascending
Search
Published: November 11 2010, 6:30:00 PM Updated: September 10 2022, 12:10:13 AM
Code snippet that demonstrates finding a product match in the eBay catalog by title. The code uses the Shopping API call FindProducts. In case multiple matching products are found, the top 3 in the response are returned.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Net; using System.IO; using System.Xml;
namespace eBayProductSearch { public class eBayProdSearch
{ private void searcgProdByTitle {
string Title = "LG 42" Plasma TV 42PQ3000" string AppID = "YourAppID"; string error; //make the FindProducts call string request = "http://open.api.ebay.com/shopping?appid=" + AppID + "&version=623&siteid=0&callname=FindProducts&MaxEntries=3&QueryKeywords=" + Title; WebRequest wrGETURL; wrGETURL = WebRequest.Create(request); Stream objStream; try { //read the response objStream = wrGETURL.GetResponse().GetResponseStream(); StreamReader objReader = new StreamReader(objStream); string strResponse = objReader.ReadToEnd(); //parse the response XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(strResponse); XmlNode root = xmlDoc["FindProductsResponse"]; string ProdIDs; if (root["Errors"] != null) { //There is an error error = root["Errors"]["ShortMessage"].InnerText; Console.WriteLine(Title + "\t" + error); } else { //Browse the response for Product matches XmlNodeList ProdList = xmlDoc.GetElementsByTagName("Product"); //There could be more than one Product match for (int i = 0; i < ProdList.Count; i++) { ProdIDs = ""; //Each Product can have multiple Product identifiers associated. //We want to get all XmlNodeList ProdIDList = ProdList[i].ChildNodes; for (int j = 0; j < ProdIDList.Count; j++) { if (ProdIDList[j].Name == "ProductID") { XmlAttributeCollection attCol = ProdIDList[j].Attributes; ProdIDs += attCol[0].Value + "\t" + ProdIDList[j].InnerText + "\t"; } } ProdIDs = ProdIDs.Replace("Reference", "ePID"); Console.WriteLine(Title + "\t" + ProdIDs); } } } catch (Exception ex) { Console.WriteLine("FindProducts error - identifier = " + Title + "\t" + ex.Message); }
}
}
}
How well did this answer your question? Answers others found helpful