Skip to Content
eBay Hacks, 2nd Edition
book

eBay Hacks, 2nd Edition

by David A. Karp
June 2005
Beginner
463 pages
14h 19m
English
O'Reilly Media, Inc.
Content preview from eBay Hacks, 2nd Edition

Retrieve Details About a Listing

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

eBay Hacks

eBay Hacks

David A. Karp
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 059610068XErrata Page