June 2005
Beginner
463 pages
14h 19m
English
Use the GetItem API call to get listing details.
The GetItem API call is used to retrieve all the details of a listing,
including the title, description, starting price, category, and about
180 other individual bits of information.
Here’s a simple script that, when provided with the item number, returns the title, seller ID, amount of time left, number of bids, and the current price:
#!/usr/bin/perl require 'ebay.pl'; $item_id = shift @ARGV or die "Usage: $0 itemnumber";my $rsp = call_api({ Verb => 'GetItem', DetailLevel => 0, Id => $item_id }); if ($rsp->{Errors}) { print_error($rsp) } else { my %i = %{$rsp->{Item}[0]};
my ($price, $currency, $bids, $time_left, $seller, $title) = @i{qw/CurrentPrice CurrencyId BidCount TimeLeft Seller Title/};
$d = $time_left->{Days}; $h = $time_left->{Hours}; $m = $time_left->{Minutes}; $s = $time_left->{Seconds}; $seller_id = $seller->{User}{UserId}; $seller_fb = $seller->{User}{Feedback}{Score}; print "Item #$item_id: $title\n"; print "For sale by $seller_id ($seller_fb)\n"; print "Currently at $currency$price, $bids bids\n"; if ($d > 0) { print "$d days, $h hours left.\n"; } elsif ($h > 0) { print "$h hours, $m minutes ...