I am trying to get all products from a user’s ebay account, but when I run my code I am only getting a few hundred. I can confirm there are 2 000 products.
How can I pull all products without using the start and end time and date parameters?
If I remove the lines of code with the <StartTimeFrom>
to <EndTimeTo>
it shows no products at all.
$url = 'https://api.ebay.com/ws/api.dll';
$user_name = "{username is in here}";
$auth_token = "{token is in here}";
for ($i = 1; $i <= 10; $i++) {
$headers = array(
'Content-Type: text/xml',
'X-EBAY-API-COMPATIBILITY-LEVEL:877',
'X-EBAY-API-DEV-NAME:177b0624-2d99-428a-8659-7404d9043c76',
'X-EBAY-API-APP-NAME:PeteNayl-d415-49bb-a950-495237441c1c',
'X-EBAY-API-CERT-NAME:6c336965-1a1f-4d11-94b1-3843c3ac995b',
'X-EBAY-API-SITEID:3',
'X-EBAY-API-CALL-NAME:GetSellerList'
);
$xml = '<?xml version="1.0" encoding="utf-8"?>
<GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>'.$auth_token.'</eBayAuthToken>
</RequesterCredentials>
<Pagination ComplexType="PaginationType">
<EntriesPerPage>200</EntriesPerPage>
<PageNumber>'.$i.'</PageNumber>
</Pagination>
<StartTimeFrom>2014-06-01T21:59:59.005Z</StartTimeFrom>
<StartTimeTo>2014-06-02T21:59:59.005Z</StartTimeTo>
<EndTimeFrom>2014-09-29T21:59:59.005Z</EndTimeFrom>
<EndTimeTo>2014-09-30T21:59:59.005Z</EndTimeTo>
<DetailLevel>ItemReturnDescription</DetailLevel>
<UserID>'.$user_name.'</UserID>
</GetSellerListRequest>';
...
4
Answers
Take a look at the official ebay doc you just have to adjust your paramters according to bold marked section below 🙂
I’ll hope I could help you.
You cannot send a request without a time range and that the period between the from and to cannot exceed 120 days. If you want to pull all the products back you are going to have to make multiple requests to GetSellerList where each request covers a particular 120 day period.
Information can be found in the eBay documentation for the both the EndTimeFrom and StartTimeFrom fields in the request. Note that the documentation does not say that the fields are required, but it you do not include them in your request a Failure value will be returned in the Ack field of the response.
I had this problem but I finally got the simple solution. The time range just shouldn’t be set greater than 120 days apart. You can start from whatever year and month you want, as long as the the values shouldn’t exceed 120 days between them. For instance, the query below returns the items from 2016.
Paging mechanism.
I came across the same problem.
To solve it I built a paging mechanism that starts at a particular EBAY_START_DATE, and loads 120 days worth of Products at a time. The date in question is based on the eBay Item’s StartTime.
Here is the pseudo code
Here is the actual implementation in python. The code also calls GetItem to get the full data on each item. This code used Tim Keefer’s excellent ebaysdk.trading library to make the calls.
I hope this is helpful. 🙂