Skip to content

Featured Project: eBay SDK for Perl

Perl Module eBay - API ver. 0.22

Project: eBay::API Perl Module

Authors: (alphabetical) Robert Bradley, Mike Evans, Milenko Milanovic, Jeff Nokes

This is a project started internally by eBay engineering that is now being made available to the public. It provides a basic framework to Perl-based API clients for integrating with eBay's Trading API. It consists of an OO Perl class hierarchy, that can control all facets of communication with eBay. Some of the features include:

  • Support for the XML API interface (will possibly add SOAP and/or REST interfaces in the future)
  • Tools for auto-generation of all command and data type classes based on published XML schema
  • Tools for generating HTML-based documentation, based on all provided and auto-generated POD
  • Capability to send "n" calls asynchronously in parallel, or synchronously
  • Sessions for basic transaction usage (no rollback capabilities)
  • Retry logic to auto-retry API calls
  • Error stub capabilities to force errors on calls (without really sending them); test your handling
  • Exception/Error handling framework to integrate with your application
  • Logging framework to integrate with your application
  • [De]Compression for handling gzip'd data

Installation

This module is available on CPAN for download. It has many prerequisite modules; the install process will let you know if you missing any of them. You should be able to install this module the standard way via make, make test, make install; via perl -MCPAN, or any other mechanism that makes use of standard Perl modules. Please refer to the information in the package file INSTALL for further details and examples.

Downloads

License

License: Common Development and Distribution License (CDDL)

The CDDL license shown as applicable on this page IS NOT the same as the one included in the CPAN distribution. The one in the distribution supercedes all others.

Usage Examples:

Here are some examples taken from the POD documentation in API.pm in this package:

# 1. GeteBayOfficialTime
use eBay::API::XML::Call::GeteBayOfficialTime;

my $pCall = eBay::API::XML::Call::GeteBayOfficialTime->new();
$pCall->execute();
my $sOfficialTime = $pCall->getEBayOfficialTime();


# 2. GetUser
use eBay::API::XML::Call::GetUser;
use eBay::API::XML::DataType::Enum::DetailLevelCodeType;

my $pCall = eBay::API::XML::Call::GetUser->new();
$pCall->setDetailLevel( [eBay::API::XML::DataType::Enum::DetailLevelCodeType::ReturnAll] );
$pCall->setUserID('userId');
$pCall->execute();

my $pUser = $pCall->getUser();
my $sStatusCode = $pUser->getStatus();
my $sSiteCode = $pUser->getSite();


# 3. VerifyAddItem
use eBay::API::XML::Call::VerifyAddItem;
use eBay::API::XML::DataType::ItemType;
use eBay::API::XML::DataType::CategoryType;
use eBay::API::XML::DataType::Enum::CountryCodeType;
use eBay::API::XML::DataType::Enum::CurrencyCodeType;
use eBay::API::XML::DataType::Enum::ListingTypeCodeType;
use eBay::API::XML::DataType::Enum::BuyerPaymentMethodCodeType;

my $pItem = eBay::API::XML::DataType::ItemType->new();
$pItem->setCountry(eBay::API::XML::DataType::Enum::CountryCodeType::US);
$pItem->setCurrency(eBay::API::XML::DataType::Enum::CurrencyCodeType::USD);
$pItem->setDescription('item description.');
$pItem->setListingDuration(eBay::API::XML::DataType::Enum::ListingTypeCodeType::Days_1);
$pItem->setLocation('San Jose, CA');
$pItem->setPaymentMethods(eBay::API::XML::DataType::Enum::BuyerPaymentMethodCodeType::PaymentSeeDescription);
$pItem->setQuantity(1);
$pItem->getStartPrice()->setValue(1.0);
$pItem->setTitle('item title');

my $pCat = eBay::API::XML::DataType::CategoryType->new();
$pCat->setCategoryID(357);
$pItem->setPrimaryCategory($pCat);

my $pCall = eBay::API::XML::Call::VerifyAddItem->new();

$pCall->setItem($pItem);
$pCall->execute();

$sItemId = $pCall->getItemID()->getValue();

Documentation

We did our best to add POD documentation as much as possible, so please refer to that first before asking questions. Also, even though this SDK provides auto-generation of command and data type classes and relative POD documentation, it is VERY important that users of this SDK also consult the official eBay Trading API documentation as the classes generated here ARE NOT a replacement for it.



Published Comments (4):

     
  1. nothus wrote the following on 1/24/2008 6:54:24 PM:
    @jnokes I installed it via FreeBSD's ports collection.
  2. jnokes wrote the following on 11/2/2007 2:21:58 PM:
    Interested on which platform you installed it, and how you installed it (i.e. command line, perl -MCPAN -eshell, etc.) If you install from the command line, it will attempt to auto-generate the datatype and call classes for you, unless you explicitly tell it otherwise. Even if CPAN installs it for you, it should still do that. If you want it to test an API call during the test phase of the installation, then you'll want to provide your sandbox API credentials as arguments. You can see all of the options by executing the following: perl Makefile.PL --help
  3. nothus wrote the following on 10/17/2007 1:53:24 AM:
    Took me a while to figure this out, but you must generate the libs!!! I did a: find / -name XSD and found it here: /usr/local/lib/perl5/site_perl/5.8.8/eBay/API/XML/Tools/CodeGen/XSD/ There is a README, which told me to run: perl genEBayApiDataTypes.pl \ --url=http://developer.ebay.com/webservices/latest/eBaySvc.xsd Which then made all the missing libs! So now the examples compile, but still does not quite work. Good luck!
  4. mispeaced wrote the following on 9/3/2007 3:06:29 PM:
    It seems that there are no eBay/API/XML/Call/GeteBayOfficialTime.pm module in this version of eBay::API (all XML::Call branch). I've installed api from CPAN - version 0.22, but even first example doesn't work for me. $ perl -MeBay::API -e 'print "$eBay::API::VERSION\n"' 0.22 After executing GeteBayOfficialTime example: Can't locate eBay/API/XML/Call/GeteBayOfficialTime.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) And of course cannot find this GeteBayOfficialTime.pm on CPAN and in eBay-API-0.22.tar.gz Or probably POD and automated tests go before the real code? :)

You must be logged in to post a comment. Log in now or join the network to get access to all the network benefits.

Featured Project not available

This Featured project is no longer available.

rating

     

Login to rate this item.

  • Average rating: 5.0
  • Submitted by:
  • Categories:

Bookmarking

Login to add this page to your bookmarks.

Tagging

Login to add your own tag