Queue API Calls

How to work around eBay’s API call limit.

Developers working under the Individual license, explained at the beginning of this chapter, have a strict limit as to the number of eBay calls they are allowed to make each day.

Provided that your application uses the API efficiently, as described in [Hack #99], this shouldn’t pose a problem. And as the theory goes, anyone needing more than 50 API calls per day is probably running a business on eBay and can justify one of the higher developer tiers.

Consider the following scenario. As a seller, you might have 55 separate auctions ending on a single day. If you use the script in [Hack #87], you can retrieve sufficient data for all your recently closed auctions with only a single GetSellerList call. But if you use the script in [Hack #90], you’ll need a minimum of 56 calls: one to retrieve the list of auctions, and 55 more to retrieve the individual auction descriptions. All you need is to run this single script just once to exceed your API quota for the day.

If you feel that exceeding your quota is a possibility, you can take some extra steps to ensure both that your software understands this limit, and that if your software reaches the limit, it can queue additional API calls and complete its work the next day.

The first step is to begin recording your API call usage. Probably the best way to do this is by adding a counter to the call_api subroutine in the ebay.pl script listed at the beginning of this chapter. The counter ...

Get eBay Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.