Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Integrate Your Inventory System with the eBay SDK : Page 3

eBay provides a Software Development Kit that makes it easy for .NET developers to create applications that incorporate the eBay marketplace. This article explains how to build a working example application that integrates with eBay.


advertisement
Making eBay SDK Calls
After creating the ApiSession object you use it to place other calls to the eBay SDK. To list an item, you first retrieve the item's data from the local inventory database, including the item's name, description, and perhaps other data about the item such as its physical location and selling price. For this sample application, you need only retrieve the item's name and description from the database using the following ADO.NET query:

Dim cn As IDbConnection = GetConnection() Dim da As OleDbDataAdapter Dim theSql As String theSql = "SELECT ID, Name, Description " & _ "FROM tblProduct " & _ "WHERE ID = " & CurrentItemID Dim ds As DataSet = New DataSet("Product") da = New OleDbDataAdapter(theSql, cn) da.Fill(ds) cn.Close()

The value CurrentItemID in the preceding code fragment gets set when the user clicks on a row in the DataGrid control.

Now that you have the information about the item you want to list, you can send it off to eBay. Do this by first creating an instance of an IItem object (found in the eBay.SDK.Model.Item namespace). This object represents, not surprisingly, the item to be listed on eBay; it contains properties that describe the item and the item's listing format. The listing format is important, because not all eBay listings are auctions —you can sell an item in a fixed-price format as well, a convenience that many buyers appreciate.

When I create an eBay SDK application, I typically create a function that specifically creates and returns an IItem. Here's an example of such a function:

Private Function CreateItem(ByVal title As String, ByVal description As String) As IItem Dim it As IItem = New eBay.SDK.Model.Item.Item With it .SiteId = SiteIdEnum.US .Type = ItemTypes.Auction .Title = title .Description = description .Currency = CurrencyEnum.USDollar .Location = "San Jose, CA" .Country = "us" .CategoryId = 14111 ' test auctions:general .Quantity = 1 .Duration = 7 .MinimumToBid = 0.01 .BuyItNowPrice = 15.0 .ReservePrice = 0 .PaymentTerms.SeeDescription = True .ShippingOptions.ShippingRange = _ ShippingRangeEnum.SiteOnly .Uuid = New Uuid(True) End With Return it End Function

Obviously, in this example, many of the values are hard-coded. In a real application, you'd retrieve data for properties like Location and MinimumBid from the database, or perhaps even from the registry or App.Config.

CategoryId is an interesting property. This example uses eBay's test category, which exists specifically for software developers and others who want to experiment. But eBay has more than 30,000 product categories, with more being added every month. If you want to incorporate this category hierarchy in your application, you can do so by downloading it in XML format (use the GetCategories method to obtain the category list).



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date