rearley/ebay

Provides a method to communicate with eBay's Finding, Shopping and Trading API.

v2.0.0 2016-06-19 01:51 UTC

README

Build Status Latest Stable Version Latest Unstable Version License

eBay API

PHP Client Library for the Ebay API.

Services

The client library currently supports the Finding, Shopping and Trading APIs.

// Call to the Trading's AddDispute call
$service = new Earley\Ebay\API\Trading('AddDispute');

// Call to the Trading's AddDispute call with the user token for authentication
$service = new Earley\Ebay\API\Trading('AddDispute','some long token string');

Add Element

Add element to the call.


$service->addElement('CallElement','CallValue');

The call above will produce the following XML document that will be passed to the Trading API.

<?xml version="1.0" encoding="UTF-8"?>
<AddDisputeRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>user_token</eBayAuthToken>
  </RequesterCredentials>
  <CallElement>CallValue</CallElement>
</AddDisputeRequest>

Add Element

This method will allow you to add an array of Elements and Values


$service = new \Earley\Ebay\API\Trading('AddDispute');

$call = array('CallElement' => 'CallValue');
$service->addElements($call);

This will produce the same result as above.

Sending API Call


// Send Request
$response = $service->send();

Working with the Response

The response object has a few methods to get the Ebay Response in a few different formats.


// Array
$object = $response->toArray();

// XML
$object = $response->toXml();

// String
$object = $response->toString();

You have a few other methods in order to get other basic information.


// Headers
$response->getHeaders();

// HTTP Code
$response->getStatusCode();

// HTTP Response Phrase
$response->getReasonPhrase();

Each service API has one required argument and a optional argument. The first argument is the API's call and the second is the user token that is required for certain calls to the trading API.

TODO

  • More detailed documentation
  • Unit Testing Completion
  • Other Ebay API Calls