Reputation: 110
Currently I'm working eBay Trading APIs. I want to get all active listings but getting 194. I have 2269 active listings in my seller account. here is my code.
$curl_resource = $this->initialize_requests("GetSellerList", false);
$xmlStr="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<GetSellerListRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">
<RequesterCredentials>
<eBayAuthToken>".$this->userToken."</eBayAuthToken>
</RequesterCredentials>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>High</WarningLevel>
<GranularityLevel>Coarse</GranularityLevel>
<StartTimeFrom>2017-06-21T06:38:48.420Z</StartTimeFrom>
<StartTimeTo>2017-08-23T06:38:48.420Z</StartTimeTo>
<IncludeWatchCount>true</IncludeWatchCount>
<Pagination>
<EntriesPerPage>50</EntriesPerPage>
</Pagination>
</GetSellerListRequest>";
$response = $this->getResponse($curl_resource, $xmlStr);
$responseObject = simplexml_load_string($response);
print_r($responseObject);
I think I should change <startTimeFrom>
and <startTimeTo>
after every call until it return null or something.
or is there a better way to do this?
Upvotes: 0
Views: 734
Reputation: 1
eBay returns 200 entries as a response in a single call, so you need to loop through the same call by passing the PageNumber element in the Pagination index while creating an XML.
Upvotes: 1
Reputation: 2097
You need to pass page number in you XML feed,because eBay API returns only 200 listings per page so you need to loop through the API call.
For example:
<?xml version="1.0" encoding="utf-8"?>
<GetMyeBaySellingRequest
xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>$this->auth_token</eBayAuthToken>
</RequesterCredentials>
<ActiveList>
<Sort>Title</Sort>
<IncludeNotes>FALSE</IncludeNotes>
<Pagination>
<EntriesPerPage>200</EntriesPerPage>
<PageNumber>$page_no</PageNumber>
</Pagination>
</ActiveList>
<HideVariations>FALSE</HideVariations>
<DetailLevel>ReturnSummary</DetailLevel>
<MessageID>$messageID</MessageID>
<Version>$this->api_version</Version>
<WarningLevel>High</WarningLevel>
</GetMyeBaySellingRequest>
Upvotes: 1