Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ebay API for listing one seller's items - GetSellerList

Tags:

ebay-api

Anyone out there with experience with the Ebay API? I'm essentially trying to list all items for one shop on their website, so it's not going to be a public service usage. The GetSellerList method seems to be the way to go, but the documentation on the Ebay Website itself is very scant and not really well done at all.

http://developer.ebay.com/DevZone/XML/docs/reference/ebay/GetSellerList.html

I'm in the process of trying out the code samples and the problem I'm hitting now is whether or not I need a UserToken or not. #PITA

Thanks,

like image 404
Carl Sargunar Avatar asked Dec 17 '13 12:12

Carl Sargunar


People also ask

Is eBay API free?

Yes, eBay API is open and free, but the access to the developer account is granted only after approval, and to certain kinds of APIs – after submitting a production application process.

Does eBay allow API?

eBay offers developers a wide range of RESTful and Traditional APIs. For new development, eBay strongly encourages the use of our RESTful APIs.

How do I retrieve data from eBay API?

To retrieve the data for a single item, use GetItem. Doing this involves three general steps: setting up the execution environment, specifying the data to return (based on the item ID), and making the API call. Retrieving the data for a single item entails specifying the item ID for the item to return.

What is Media API for eBay?

The Media API allows users to create, upload, and fetch videos. Tip: See Managing videos in the Selling Integration Guide to learn more about how to create and upload videos with the Media API, how to add videos to listings, and best practices for interacting with eBay video services.


2 Answers

Here is about the minimum request I used that worked for me:

<?xml version="1.0" encoding="utf-8"?>
<GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>--Enter your AuthToken here--</eBayAuthToken>
  </RequesterCredentials>
  <ErrorLanguage>en_US</ErrorLanguage>
  <WarningLevel>High</WarningLevel>
  <StartTimeFrom>2013-06-01T21:59:59.005Z</StartTimeFrom> 
  <StartTimeTo>2013-09-26T21:59:59.005Z</StartTimeTo>
  <EndTimeFrom>2013-09-26</EndTimeFrom>
  <EndTimeTo>2013-11-26</EndTimeTo>
  <GranularityLevel>Coarse</GranularityLevel>
  <UserID>--Enter your seller's name here--</UserID>
  <Pagination>
    <EntriesPerPage>200</EntriesPerPage>
    <PageNumber>1</PageNumber>
  </Pagination>
  <OutputSelector>ItemArray.Item.ItemID</OutputSelector>
  <OutputSelector>ItemArray.Item.Quantity</OutputSelector>
  <OutputSelector>ItemArray.Item.Title</OutputSelector>
  <OutputSelector>ItemArray.Item.PrimaryCategory.CategoryID</OutputSelector>
  <OutputSelector>ItemArray.Item.PrimaryCategory.CategoryName</OutputSelector>
</GetSellerListRequest>

I also had to add these headers to the request:

X-EBAY-API-APP-NAME             -- Add yours here --
X-EBAY-API-CALL-NAME            GetSellerList
X-EBAY-API-REQUEST-ENCODING     XML
X-EBAY-API-SITEID               0
X-EBAY-API-DEV-NAME             -- Add yours here --
X-EBAY-API-CERT-NAME            -- Add yours here --
X-EBAY-API-COMPATIBILITY-LEVEL  825

I'm not sure which of the "-- Add yours here --" entries are public and which are private, so I'll aire on the side of caution and I'll let you get them for yourself.. :-)

With no eBayAuthToken entered, you get the following error:

   <Errors>
      <ShortMessage>Auth token is invalid.</ShortMessage>
      <LongMessage>Validation of the authentication token in API request failed.</LongMessage>
      <ErrorCode>931</ErrorCode>
      <SeverityCode>Error</SeverityCode>
      <ErrorClassification>RequestError</ErrorClassification>
   </Errors>

I hope this helps.

like image 165
Ads Avatar answered Sep 20 '22 02:09

Ads


<?xml version="1.0" encoding="utf-8"?>
<GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>$authToken</eBayAuthToken>
  </RequesterCredentials>
  <ErrorLanguage>en_US</ErrorLanguage>
  <WarningLevel>High</WarningLevel>
  <StartTimeFrom>2015-01-01T00:00:00.005Z</StartTimeFrom> 
  <StartTimeTo>2015-03-31T23:59:59.005Z</StartTimeTo>
  <EndTimeFrom>2015-03-31T23:59:59.005Z</EndTimeFrom>
  <EndTimeTo>2015-05-31T23:59:59.005Z</EndTimeTo>
  <GranularityLevel>Coarse</GranularityLevel>
  <UserID>----testuser----</UserID>
  <Pagination>
    <EntriesPerPage>200</EntriesPerPage>
    <PageNumber>1</PageNumber>
  </Pagination>
  <OutputSelector>ItemArray.Item.ItemID</OutputSelector>
  <OutputSelector>ItemArray.Item.Quantity</OutputSelector>
  <OutputSelector>ItemArray.Item.Title</OutputSelector>
  <OutputSelector>ItemArray.Item.PrimaryCategory.CategoryID</OutputSelector>
  <OutputSelector>ItemArray.Item.PrimaryCategory.CategoryName</OutputSelector>
</GetSellerListRequest>

Header Request Values

$headers = array(
        'X-EBAY-API-SITEID:'.SITEID,
        'X-EBAY-API-CALL-NAME:GetSellerList',
        'X-EBAY-API-REQUEST-ENCODING:'.RESPONSE_ENCODING,
        'X-EBAY-API-COMPATIBILITY-LEVEL:' . API_COMPATIBILITY_LEVEL,
        'X-EBAY-API-DEV-NAME:' . API_DEV_NAME,
        'X-EBAY-API-APP-NAME:' . API_APP_NAME,
        'X-EBAY-API-CERT-NAME:' . API_CERT_NAME,
        'Content-Type: text/xml;charset=utf-8'
    );
like image 43
Kuldeep Singh Avatar answered Sep 20 '22 02:09

Kuldeep Singh