1Net::eBay(3) User Contributed Perl Documentation Net::eBay(3)
2
3
4
6 Net::eBay - Perl Interface to XML based eBay API.
7
9 Version 0.61
10
12 This module helps user to easily execute queries against eBay's XML
13 API. Copyright Igor Chudov, ichudov@algebra.com. Released under GNU
14 Public License v. 2
15
16 ##################################################
17 # For support, docs, info, email to author go to #
18 # #
19 # http://www.net-ebay.org/ #
20 ##################################################
21
22 Also check out Object::eBay perl module for higher level abstraction
23 built on top of Net::eBay. Object::eBay is a work of another
24 individual, not Igor Chudov.
25
26 Also check out several ebay-*.pl scripts that ship with this
27 distribution, they should be installed in your scripts directory.
28
29 Getting Official Time
30 use Net::eBay;
31 my $eBay = new Net::eBay; # look up ebay.ini in $ENV{EBAY_INI_FILE}, "./ebay.ini", "~/.ebay.ini"
32 my $result = $eBay->submitRequest( "GeteBayOfficialTime", {} );
33 print "eBay Official Time = $result->{EBayTime}.\n";
34
35 Automated bidding
36 eBay does not allow bidding via eBay API.
37
38 Listing Item for sale
39 use Net::eBay;
40 use Data::Dumper;
41
42 # another way of creating Net::eBay object.
43 my $ebay = new Net::eBay( {
44 SiteLevel => 'prod',
45 DeveloperKey => '...',
46 ApplicationKey => '...',
47 CertificateKey => '...',
48 Token => '...',
49 } );
50
51 my $result = $ebay->submitRequest( "AddItem",
52 {
53 DetailLevel => "0",
54 ErrorLevel => "1",
55 SiteId = > "0",
56 Verb => " AddItem",
57 Category => "14111",
58 CheckoutDetailsSpecified => "0",
59 Country => "us",
60 Currency => "1",
61 Description => "For sale is like new <A HREF=http://www.example.com/jhds/>thingamabob</A>.Shipping is responsibility of the buyer.",
62 Duration => "7",
63 Location => "Anytown, USA, 43215",
64 Gallery => 1,
65 GalleryURL => 'http://igor.chudov.com/images/mark_mattson.jpg',
66 MinimumBid => "0.99",
67 BuyItNowPrice => 19.99,
68 PayPalAccepted => "1",
69 PayPalEmailAddress => "ichudov\@example.com",
70 Quantity => "1",
71 Region => "60",
72 Title => "Igor's Item with Gallery xaxa",
73 }
74 );
75
76 print "Result: " . Dumper( $result ) . "\n";
77
78 Result of submitRequest is a perl hash obtained from the response XML
79 using XML::Simple, something like this:
80
81 Result: $VAR1 = {
82 'Item' => {
83 'Id' => '4503546598',
84 'Fees' => {
85 'FeaturedGalleryFee' => '0.00',
86 'InternationalInsertionFee' => '0.00',
87 'CurrencyId' => '1',
88 'GalleryFee' => '0.25',
89 'AuctionLengthFee' => '0.00',
90 'ProPackBundleFee' => '0.00',
91 'BorderFee' => '0.00',
92 'FeaturedFee' => '0.00',
93 'SchedulingFee' => '0.00',
94 'HighLightFee' => '0.00',
95 'FixedPriceDurationFee' => '0.00',
96 'PhotoDisplayFee' => '0.00',
97 'ListingFee' => '0.55',
98 'BuyItNowFee' => '0.00',
99 'PhotoFee' => '0.00',
100 'GiftIconFee' => '0.00',
101 'SubtitleFee' => '0.00',
102 'InsertionFee' => '0.30',
103 'ListingDesignerFee' => '0.00',
104 'BoldFee' => '0.00',
105 'ReserveFee' => '0.00',
106 'CategoryFeaturedFee' => '0.00'
107 },
108 'StartTime' => '2005-08-30 04:50:47',
109 'EndTime' => '2005-09-06 04:50:47'
110 },
111 'EBayTime' => '2005-08-30 04:50:47'
112 };
113
114 See an alternative example of submitting an item using New Schema, in
115 script ebay-add-item.pl.
116
117 If an error in parsing XML occurs, result will be simply the string
118 that is the text representation of the answer.
119
121 new -- creates eBay API. Requires supplying of credentials:
122 DeveloperKey, ApplicationKey, CertificateKey, Token. Net::eBay will not
123 be created until these keys and the token are supplied.
124
125 Get them by registering at http://developer.ebay.com and self
126 certifying. Celf certifying is a trivial process of solemnly swearing
127 that you are ready to use their API.
128
129 The SiteLevel parameter is also mandatory and can be either 'prod' or
130 'dev'. prod means to use their production site (being charged real
131 money for listings, etc), and dev means to use eBay sandbox
132 http://sandbox.ebay.com/.
133
134 Parameters can be supplied in two ways:
135
136 1) As a hash table
137
138 2) As a filename (only argument). If filename and hash are missing,
139 Net::eBay makes an effort to fine a ebay.ini file by looking for:
140 $ENV{EBAY_INI_FILE}, ./ebay.ini, ~/.ebay.ini . That's the default
141 constructor.
142
143 See SAMPLE.ebay.ini in this distribution.
144
146 This module, by default, is using the "Legacy XML API" that is set to
147 expire in the summer of 2006. That default will change as the legacy
148 API actually expires.
149
150 XML API Schema is set by calling setDefaults( { ... } )
151
152 See its documentation below.
153
155 ebay.ini is a file that lists ebay access keys and whether this is for
156 accessing eBay production site or its developers' sandbox. Example of
157 the file (see SAMPLE.ebay.ini):
158
159 # dev or prod
160 SiteLevel=prod
161
162 # your developer key
163 DeveloperKey=KLJHAKLJHLKJHLKJH
164
165 # your application key
166 ApplicationKey=LJKGHKLJGKJHG
167
168 # your certificate key
169 CertificateKey=SUYTYWTKWTYIUYTWIUTY
170
171 # your token (a very BIG string)
172 Token=JKHGHJGJHGKJHGKJHGkluhsdihdsriuhfwe87yr8wehIEWH9O78YWERF90HF9UHJESIPHJFV94Y4089734Y
173
175 new
176 setDefaults
177 Sets application defaults, most importantly the XML API version to be
178 used.
179
180 Takes a hash argument.
181
182 The following defaults can be set:
183
184 * API -- sets eBay API version. Only two values are supported: '1'
185 means Legacy API set to expire in the summer of 2006, '2' means the API
186 that supersedes it. All other values are illegal.
187
188 * debug -- if debug is set to true, prints a lot of debugging
189 information, XML sent and received etc.
190
191 * siteid -- sets site id
192
193 * compatibility -- "compatibility level" with eBay. Set to a sensible
194 default.
195
196 * timeout -- sets default query timeout, default is 50 seconds
197
198 * retries -- sets the number of times a failed request should be
199 retried. Defaults to 2 according to <http://xrl.us/bk7vb> This only
200 retries requests where eBay is to blame for the failure. Faulty API
201 requests are not retried.
202
203 Example:
204
205 $eBay->setDefaults( { API => 2 } ); # use new eBay API
206 $eBay->setDefaults( { API => 2, debug => 1 } ); # use new eBay API and also debug all calls
207
208 submitRequest
209 Sends a request to eBay. Takes a name of the API call and a hash of
210 arguments. The arguments can be hashes of hashes and are properly
211 translated into nested XML structures.
212
213 Example:
214
215 TopLevel => {
216 Item1 => 'hello',
217 Item2 => 'world'
218 Item3 => ['foo', 'bar']
219 }
220
221 it would be translated to
222
223 <TopLevel>
224 <Item1>hello</Item1>
225 <Item2>world</Item2>
226 <Item3>foo</Item3>
227 <Item3>bar</Item3>
228 </TopLevel>
229
230 If an argument has XML attributes and should be formatted like this:
231
232 <TestAttribute currencyID="USD" >abcd</TestAttribute>
233
234 (note "currencyID")
235
236 your argument should be
237
238 TestAttribute => { _attributes => { currencyID => 'USD' }, _value => 'abcd' ),
239
240 Depending on the default API set by setDefaults (see above), XML
241 produced will be compatible with the eBay API version selected by the
242 user.
243
244 officialTime
245 Returns eBay official time
246
247 UTF8 Internal ONLY function
248 hash2xml Internal ONLY function
249 submitRequestGetText Internal ONLY function
250 verifyAndPrint Internal ONLY function
252 Igor Chudov, "<ichudov@algebra.com>"
253
255 Please report any bugs or feature requests to
256 "bug-net-ebay@rt.cpan.org", or through the web interface at
257 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-eBay>. I will be
258 notified, and then you'll automatically be notified of progress on your
259 bug as I make changes.
260
263 Copyright 2005 Igor Chudov, all rights reserved.
264
265 This program is free software; you can redistribute it and/or modify it
266 under the same terms as Perl itself.
267
268
269
270perl v5.28.0 2012-06-18 Net::eBay(3)