• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. The eBay API > 109. Retrieve Details About a Listing

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 left.\n"; }
		elsif ($s > 0) { print "$m minutes, $s seconds left.\n"; }
		else { print "auction ended.\n"; }
	}

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint