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

8. The eBay API > 117. Automatically Relist Unsuccessful Listings

Automatically Relist Unsuccessful Listings

Save time by automatically relisting items that received no bids or have a reserve that wasn’t met.

Most of the time, when an auction ends without receiving any bids or with a reserve that wasn’t met, sellers end up relisting the item, but this can be rather laborious, especially if you have more than a few auctions to relist.

The following script will relist for you, and when run on a regular basis—say, every day—you’ll never have to manually relist an auction again:

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

	      $localfile = "autorelist.txt"; 
          $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;

               }
               LOOP:
               foreach (@{$rsp->{SellerList}{Item}}) {
         ....              if ($bidder->{User}{Email} !~ "\@") { 
                 open (INFILE,"$localdir/$localfile"); 
                   while ( $line = <INFILE> ) {  
                    if ($line eq "$id\n") { last LOOP; } 
                   } 
               close (INFILE);

              my $rsp = call_api({Verb => 'RelistItem',
                            DetailLevel => 0,
                                 SiteId => $site_id,
                                 ItemId => $id
               });
               if ($rsp->{Errors}) {
                 print_error($rsp)
               } else {
                 print "Relisted item $id as #$rsp->{Item}[0]{Id}\n";
                 open (OUTFILE,">>$localdir/$localfile");  
                    print OUTFILE "$id\n"; 
                 close (OUTFILE); 
               } 
             } 
            }
            last PAGE unless $rsp->{SellerList}{HasMore Items};
            $page_number++;
         }

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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