NAME
eBay::API::Simple::Trading - Support for eBay's Trading web service
DESCRIPTION
This class provides support for eBay's Trading web services.
See http://developer.ebay.com/products/trading/
USAGE
my $call = eBay::API::Simple::Trading->new( {
appid => '<your appid>',
devid => '<your devid>',
certid => '<your certid>',
token => '<auth token>',
} );
$call->execute( 'GetSearchResults', { Query => 'shoe' } );
if ( $call->has_error() ) {
die "Call Failed:" . $call->errors_as_string();
}
# getters for the response DOM or Hash
my $dom = $call->response_dom();
my $hash = $call->response_hash();
print $call->nodeContent( 'Timestamp' );
my @nodes = $dom->findnodes(
'//Item'
);
foreach my $n ( @nodes ) {
print $n->findvalue('Title/text()') . "\n";
}
SANDBOX USAGE
my $call = eBay::API::Simple::Trading->new( {
appid => '<your appid>',
devid => '<your devid>',
certid => '<your certid>',
token => '<auth token>',
domain => 'api.sandbox.ebay.com',
} );
$call->execute( 'GetSearchResults', { Query => 'shoe' } );
if ( $call->has_error() ) {
die "Call Failed:" . $call->errors_as_string();
}
# getters for the response DOM or Hash
my $dom = $call->response_dom();
my $hash = $call->response_hash();
PUBLIC METHODS
new( { %options } }
Constructor for the Trading API call
my $call = eBay::API::Simple::Trading->new( {
appid => '<your appid>',
devid => '<your devid>',
certid => '<your certid>',
token => '<auth token>',
...
} );
Options
- appid (required)
-
This is required by the web service and can be obtained at http://developer.ebay.com
- devid (required)
-
This is required by the web service and can be obtained at http://developer.ebay.com
- certid (required)
-
This is required by the web service and can be obtained at http://developer.ebay.com
- token (required)
-
This is required by the web service and can be obtained at http://developer.ebay.com
- siteid
-
eBay site id to be supplied to the web service endpoint
defaults to 0
- domain
-
domain for the web service endpoint
defaults to open.api.ebay.com
- uri
-
endpoint URI
defaults to /ws/api.dll
- version
-
Version to be supplied to the web service endpoint
defaults to 543
- https
-
Specifies is the API calls should be made over https.
defaults to 1
ALTERNATE CONFIG VIA ebay.ini
The constructor will fallback to the ebay.ini file to get any missing credentials. The following files will be checked, ./ebay.ini, ~/ebay.ini, /etc/ebay.ini which are in the order of precedence.
# your developer key
DeveloperKey=KLJHAKLJHLKJHLKJH
# your application key
ApplicationKey=LJKGHKLJGKJHG
# your certificate key
CertificateKey=SUYTYWTKWTYIUYTWIUTY
# your token (a very BIG string)
Token=JKHG7yr8wehIEWH9O78YWERF90HF9UHJESIPHJFV94Y4089734Y
execute( $verb, $call_data )
$call->execute( 'GetSearchResults', { Query => 'shoe' } );
This method will construct the API request based on the $verb and the $call_data and then post the request to the web service endpoint.
- $verb (required)
-
call verb, i.e. GetSearchResults
- $call_data (required)
-
hashref of call_data that will be turned into xml.
BASECLASS METHODS
request_agent
Accessor for the LWP::UserAgent request agent
request_object
Accessor for the HTTP::Request request object
request_content
Accessor for the complete request body from the HTTP::Request object
response_content
Accessor for the HTTP response body content
response_object
Accessor for the HTTP::Request response object
response_dom
Accessor for the LibXML response DOM
response_hash
Accessor for the hashified response content
nodeContent( $tag, [ $dom ] )
Helper for LibXML that retrieves node content
errors
Accessor to the hashref of errors
has_error
Returns true if the call contains errors
errors_as_string
Returns a string of API errors if there are any.
PRIVATE METHODS
_validate_response
This is called from the base class. The method is suppose to provide the custom validation code and push to the error stack if the response isn't valid
_get_request_body
This method supplies the request body for the Shopping API call
_get_request_headers
This method supplies the headers for the Shopping API call
_get_request_object
This method creates the request object and returns to the parent class
AUTHOR
Tim Keefer <tim@timkeefer.com>
CONTRIBUTORS
Jyothi Krishnan
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 176:
'=item' outside of any '=over'
- Around line 208:
You forgot a '=back' before '=head1'