Skip to main content
Published: June 03 2009, 4:34:00 PMUpdated: November 28 2020, 7:37:01 PM

 

Shopping API Sample:

(Replace YourAppID with your production AppID)

 <html>
  <head>
    <title>eBay Search Results</title>
  </head>

  <body>

    <h1>eBay Search Results</h1>

    <div id="results"></div>

    <script>
      function _cb_FindItemsAdvanced(root)
     {
        var items = root.SearchResult[0].ItemArray.Item || [];
       var html = [];
       for (var i = 0; i < items.length; ++i)
       {
         var item = items[i];
         var title = item.Title;
         var viewitem = item.ViewItemURLForNaturalSearch;
         var distance = item.DistanceFromBuyer.Value;
         var price = item.ConvertedCurrentPrice.Value;
  
         if (null != title && null != viewitem)
         {
           html.push('<a href="' + viewitem + '">' + title + '</a>&nbsp;'+ distance +'&nbsp;' + price + '   <br/>');
         }
       }
       document.getElementById("results").innerHTML = html.join("");
     }
    </script>
 
    <script src="http://open.api.ebay.com/shopping?
      appid=YourAppID
      &version=613
      &siteid=0 
      &callname=FindItemsAdvanced
      &QueryKeywords=nintendo%20wii%20fit
      &PriceMin.value=200
      &PriceMax.value=300
      &MaxDistance=200
      &PostalCode=95125
      &IncludeSelector=SearchDetails
      &MaxEntries=3
      &responseencoding=JSON
      &callback=true">
    </script>  

  </body>

</html>

 

 


 

How well did this answer your question?