Using the eBay API Test Tool

The eBay API Test Tool is an essential aid to understand how eBay works. In fact, you should probably create a link to this particular site and use it as part of your application development process. This tool helps you build the XML documents required to make an eBay Web Services request. Yes, it's also a test tool, but I've begun looking at it less as a tool for testing and more as a tool for designing. You'll find this tool at http://developer.ebay.com/DevZone/ build-test/test-tool.asp. Figure 4.10 shows how this page looks when you first open it.

FIGURE 4.10:

Use the eBay API Test Tool to build XML requests for your application.

3 efîay Develflper ?Dne - Microsoft Inlernet Oplcrer

bb®

Eile fdit ^cw Fäf^tcs lexis UctH

C3i: Ä] http; t/devefcper .ebay.cotrVDevZoneJbuild-tMittest-tool. asp

ill*

Go

Welcome to API Test Tool

a

FTeaee selectüne V

j Z.Set Certificate:

1 uevlu: Applij

CertiU'

_il

i --■

1 3. Set User 8. Password:

Compatibility Level:

User: Password:

3115

1 L-1

1 4. Select a RequestTemplatt:

1 Please select one

V.

1 Optianels |

[ Sub mil 1

i. ■

The first step for using this tool is to choose a host. You can use either the SandBox or Production host if you have keys for that host. Generally, most developers will only have access to the SandBox host and that's what all of the examples in this book will use. Notice that you also have to provide the usual information for an eBay application including your developer ID, application ID, certificate ID, username, and password. There probably isn't a good reason to change the Compatibility Level field; although, the compatibility level can affect the output of a particular call (see the API Technical Reference at http://developer .ebay.com/DevZone/docs/API_Doc/index.asp for details). The final step is to select one of the API calls, which can be any of the following at the time of writing:

Addltem

Getltem

ReviseCheckoutStatus

Addltem—Motors

GetltemTransactions

ReviseCheckoutTransactionDetails

Addltem—Real

GetLogoURL

ReviseItem

Estate Ad-Type

Addltem—Real

GetSearchResults

ReviseItem—Motors

Estate Sale

Addltem—

GetSellerEvents

ReviseItem—Real Estate Ad-Type

Store-Auction

Addltem—Store-Fixed

GetSellerList

ReviseItem—Real Estate Sale

AddToltemDescription

GetSellerTransactions

ReviseItem—Store-Auction

Endltem

GetStoreDetails

ReviseItem—Store-Fixed

GetAccount

GetUser

SetSellerPaymentAddress

GetBidderList

GetWatchList

ValidateTestUserRegistration

GetCategories

LeaveFeedback

VerifyAddltem

GetCategory2

RelistItem

VerifyAddltem—Motors

DomainMap

GetCategoryListings

RelistItem—Motors

VerifyAddltem— Real Estate Ad-Type

GetDomains

RelistItem—Real Estate Ad-Type

VerifyAddItem—Real Estate Sale

GeteBayOfficialTime

RelistItem— Real Estate Sale

VerifyAddItem—Store-Auction

GetFeedback

RelistItem— Store-Auction

VerifyAddItem—Store-Fixed

GetHighBidders

RelistItem—Store-Fixed

GetHighBidders

RelistItem—Store-Fixed

As soon as you select an API call, the tool will generate the minimal XML required to make that call. You can also copy and paste examples from the API Technical Reference into the API Test Tool or create XML requests of your own that you want to try. (The XML appears in the window at the bottom of Figure 4.10.) For example, the GetSearchResults call generates XML that looks like this:

<?xm1 version="1.0" encoding="iso-8859-1"?>

<request xm1ns="urn:eBayAPIschema">

<RequestUserId>User Name</RequestUserId>

<RequestPassword>Password</RequestPassword>

<Detai1Leve1>0</Detai1Leve1>

<ErrorLeve1>1</ErrorLeve1>

<Query>toy</Query>

<SiteId>0</SiteId>

<Verb>GetSearchResu1ts</Verb>

You can set the required information at this point. In this case, the only information you'd need to change is the <Query> element. You now have a minimal request put together. However, you don't have to stop here. You can add more information to the request by clicking the Optionals button. The tool displays an index number dialog box that you can safely click OK to close. You'll see a list of optional arguments for the current API call. Figure 4.11 shows a partial list of the optional arguments for the GetSearchResults call.

FIGURE 4.11:

Optional arguments make it possible to create a more precise request.

FIGURE 4.11:

Optional arguments make it possible to create a more precise request.

Notice that many of these entries contain the default values for that optional argument. To select one of the optional arguments, check the box next to the argument entry. Fill in a value for that argument (you can change it later). Click Done when you're finished adding optional arguments.

When you finish adding arguments, the XML is finished. You can use this display to create the code for your application. If you want to test the XML to ensure it fulfills the minimum requirements, click Submit. The eBay API Test Tool will make the request and open a new window showing the result. Figure 4.12 shows an example of the output you'll see.

This output information is also very helpful because it tells you how to interact with the XML you receive from eBay as the result of a request. The response helps you understand the structure of the XML and how you'll have to parse it in your application. It also shows the location of various pieces of information. In sum, the entire eBay API Test Tool is a useful design aid.

FIGURE 4.12:

The output provides a view of the XML you'll receive from eBay Web Services.

3 eBay API Call Results - Microsoft Internet Explorer

3 eBay API Call Results - Microsoft Internet Explorer

<?xml version=" 1.0" encoding-"iso-88SQ-l" ?> - <request xmlris="urn:cBavAPIschcma">

<Req u B s tUserId> B u b b a M9999 </Reques tU serl d>

<Reques tPass word > Il a ma 4me</Re q u e s tPass word >

<SiteId>0</SiteId>

< Verb > g et s g a rch Re s u It s </V e rb>

<Searc h InDesc ri p ti o n > 0 </S e a rch [ n D e scriptior»

<?xml version=" 1.0" encoding-"iso-88SQ-l" ?> - <request xmlris="urn:cBavAPIschcma">

<Req u B s tUserId> B u b b a M9999 </Reques tU serl d>

<Reques tPass word > Il a ma 4me</Re q u e s tPass word >

<SiteId>0</SiteId>

< Verb > g et s g a rch Re s u It s </V e rb>

<Searc h InDesc ri p ti o n > 0 </S e a rch [ n D e scriptior»

<?xml version=" 1,0" encoding="i£o-88S9-l" ?> - <eBay>

<e6ayTime>2004-02-15 12:21:14</eBayTime> - <Search> - <Items> - <Item>

<ld>4500615279</Id>

<![CDATA[ The Amazing Game ]]> </Title>

< ! [CDATA[ http ;//cgi.sandbox.etoay.com/ws/eBayISAPI.dlI? Vi exalt em£ i t ero= 4500 615279scat e go r y=3 55 1 ] >

<Curr8ntPrtce> 19*95</CurrentPrice>

< Lo c al izedCurren t P ri ce > $ 19.95</Loca Ii zedCurrentPrice> <B]NPrice>$l 19.95</8INPrtce> <BidCount>0</BidCQunt>

<StartTime>20Q4-02-l3 16:55:32</StartTime> <EndTime>2004-G2-18 16:55:32</EndTimB>

Ebay PowerSeller

Ebay PowerSeller

The Definitive Guide to Becoming an eBay Powerseller guides you through the rules, giving lists of prohibited items, behaviors, and other landmines.

Get My Free Ebook


Post a comment