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

8. The eBay API > 112. Automatically Keep Track of Items You’ve Sold

Automatically Keep Track of Items You’ve Sold

Retrieve and store completed listing data without typing.

As explained in “Keep Track of Items You’ve Sold” [Hack #83] , it’s vital for every seller to keep permanent, off-site records of every single auction he or she has sold.

This script, when run daily [Hack #21] , does it all:

	#!/usr/bin/perl
	require 'ebay.pl';

	$today = &formatdate(time);
	$yesterday = &formatdate(time - 86400);

	my $page_number = 1;
	PAGE:
	while (1) {
		my $rsp = call_api({ Verb => 'GetSellerList',
					  DetailLevel => 8,
					       UserId => $user_id,
			     	   EndTimeFrom => $yesterday,
					   EndTimeTo => $today,
					   PageNumber => $page_number
   });

   if ($rsp->{Errors}) {
    print_error($rsp);
    last PAGE;

   }
   foreach (@{$rsp->{SellerList}{Item}}) { 
     my %i = %$_; 
	 ($id, $enddate, $title, $currency, $price, $highbidder) =
		 @i{qw/Id EndTime Title CurrencyId CurrentPrice HighBidder/};
     if (! -e "$localdir/$id") {
	  open (OUTFILE,">$localdir/$id"); 
	  print OUTFILE "[Details]\n"; 
	  print OUTFILE "enddate=$enddate\n"; 
	  print OUTFILE "itemnumber=$id\n"; 
	  print OUTFILE "title=$title\n"; 
	  print OUTFILE "price=$currency$price\n"; 
	  print OUTFIL....Items};
    $page_number++;
 }

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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