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
 

Monitor eBay Auctions with Visual Studio.NET : Page 3

While you could use eBay's Web interface to enter all your sale items, why waste the time? You're a .NET developer! You can use eBay's API and SDK in conjunction with .NET, XML and Excel for better portability, security, and performance.


advertisement
Application Architecture
To the user, the Word application appears as a simple document with a table for search criteria, a search button, and a search results table, as shown in Table 1 below. The user enters the search criteria, presses the Search button, and the matching items appear in the search results table. The items in the search results table are hyperlinked. Pressing the hyperlink displays the eBay listing for the item.

Table 1. A User's View: The application appears as a simple document with a table for search criteria, a search button, and a search results table.

Search Criteria



Name

Value

Description

Car

Min Price

200

Max Price

400

 

 

Search Results

Title

Price

NEW! 24 Pc. Complete Custom Neon Car Kit RED

219.95

CD-PLAYER/SPEAKERS/AMP/SUBS Car Audio System

234.95

NEW! (2) 7" Car LCD Monitors + DVD/MP3 Player

259.95

NEW Car CD Player/Subs/Speakers/Amp/Kit/Equal

259.95

NEW Car Monitors/DVD Player Package FREE SHIP

294.95

NEW! BOSS 10.4" Flip-down TFT Car Monitor + Remote

279.95

NEW! 6" In-dash LCD TFT Car Monitor w/Remote +WARRANTY

204.95

NEW SONY MZ-NF810CK Portable Net MP3 Recorder + Car Kit

229.95

Connecting to eBay
Every call made via the SDK is independent. As such, the each call is validated to ensure it is coming from an "authorized" source. To become authorized, you must sign up with the eBay Developer Program and receive developer, application, and certification Ids. This can be done at no cost on the eBay developers Web site. Once you are enrolled in the program, you will be sent the appropriate ids and you can then create and validate test userIDs and password.

You must also pass along user information that is used to ensure that the caller has a valid eBay account. Currently, this can be done by also passing a user ID and password. As you can imagine, some users have balked at entering their eBay user ID and password. As a result, eBay has developed a new mechanism that allows the user to log into eBay via the standard eBay login mechanism and your application is handed a token representing this correct login. Your calls to the API use this token instead of the user ID and password. This mechanism is known as "Authorization and Authentication."

Filling in this authorization information for each call is at best tedious, and worse, error-prone. To make it easier, the SDK has an APISession object that can be filled out once and reused to each call. The sample application uses the following code to initialize the APISession object:

// Perform the one-time initialization needed to use the eBay SDK public static void InitializeeBay() { DateTime dtNow = DateTime.Now, dtExpire = dtNow.AddDays(1); // Create and initialize the API Session apiSession = new ApiSession(); // Set up application key data apiSession.Url = "https://api.sandbox.ebay.com/ws/api.dll"; apiSession.Developer = "your developer ID"; apiSession.Application = "you Application ID"; apiSession.Certificate = "your certificate"; apiSession.RequestUserId = "your user ID"; apiSession.RequestPassword = "your password"; }

The populated APISession object must be passed with each call.

Specifying Search Criteria
The sample application lets users specify the search criteria through a simple table. The table in the sample utilizes only a few of the possible search criteria. The code to create the table is shown below:

// Create the parameter table Word.Range rng = ThisDocument.Range(ref location, ref location); CriteriaTable = ThisDocument.Tables.Add(rng, 5, 2, ref missingValue, ref missingValue); CriteriaTable.Columns[1].SetWidth(ThisApplication.InchesToPoints((float)1.25), Word.WdRulerStyle.wdAdjustNone ); CriteriaTable.Columns[2].SetWidth(ThisApplication.InchesToPoints ((float)1.25), Word.WdRulerStyle.wdAdjustNone ); CriteriaTable.Cell(1,2).Merge(CriteriaTable.Cell(1,1)); CriteriaTable.Cell(1,1).Range.Text = "Search Criteria"; CriteriaTable.Cell(1,1).Range.Font.Bold = 1; CriteriaTable.Cell(1,1).Range.Font.Size= 14.0F; CriteriaTable.Cell(2,1).Range.Text = "Name"; CriteriaTable.Cell(2,2).Range.Text = "Value"; CriteriaTable.Cell(2,1).Range.Font = HeaderFnt; CriteriaTable.Cell(2,2).Range.Font = HeaderFnt; // Criterium CriteriaTable.Cell(3,1).Range.Text = "Description"; CriteriaTable.Cell(3,2).Range.Text = "Car"; CriteriaTable.Cell(4,1).Range.Text = "Min Price"; CriteriaTable.Cell(4,2).Range.Text = ""; CriteriaTable.Cell(5,1).Range.Text = "Max Price"; CriteriaTable.Cell(5,2).Range.Text = ""; // Border CriteriaTable.Borders.InsideLineStyle = Word.WdLineStyle.wdLineStyleSingle; CriteriaTable.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleDouble;



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