rebay icon indicating copy to clipboard operation
rebay copied to clipboard

Pagination on find

Open thelal opened this issue 12 years ago • 2 comments

I can see results info coming back from find_items_in_ebay_stores call but it doesn't handle pagination of the results. I can pass the pagination (page#) parameter but I get the same set (top 100 records) of data each time.

I need to be able to retrieve that other data (by pagenumber) and see the count info (totalPages and totalEntries)

in rebay / lib / rebay / finding.rb lines 57-58 you pull back only the 'items' array It appears extra meta data is as follows (I see this after the 1st item record and before the next one (searchResult) )
Note: I changed data below where store to <>

"@count"=>"10 0"}, @response={"itemSearchURL"=>"http://stores.ebay.com/<>/_i.html?_fss=1&_saslop=1&LH_SpecificSeller=1&_ddo=1&_exm aitems=1&_ipg=100&_pgn=1&_sid=1032732382&_ssn=<>", "ack"=>"Success", "paginationOutput"=>{"entriesPerPage"=>"10 0", "totalPages"=>"39", "totalEntries"=>"3826", "pageNumber"=>"1"}, "version"=>"1.12.0", "timestamp"=>"2012-10-0 9T05:16:31.558Z", "searchResult"=>{"item"

Code I'm using to call as follows: response = finder.find_items_in_ebay_stores( {:storeName => '<<Storename>>', :pagination => {:entries_per_page => 100, :page_number => page_num} } )

thelal avatar Oct 09 '12 05:10 thelal

created temp workaround. api.rb (line 30) needs its parms changed as passing wrong parms to ebay -- it needs to be in format &paginationInput.entriesPerPage=##&paginationInput.pageNumber=##

in finding.rb (before line 57) also return extra parm of pg = response.results['paginationOutput'] so can then pullout 'totalPages, 'totalEntries', 'pageNumber', 'entriesPerPage'

thelal avatar Oct 10 '12 00:10 thelal

@thelal, I am sure you have gotten past this already, but I just wanted to show you (and others) an example of how I get pagination information.

Here is a simple example:

finding_response = Rebay::Finding.new.find_items_by_keywords(
  :keywords => 'stuff',
  :'paginationInput.entriesPerPage' => '100',
  :'paginationInput.pageNumber' => '1',
)

# the results/items
finding_response.results

# the pagination information
finding_response.response["paginationOutput"] # => { 'entriesPerPage' => 100, 'pageNumber' => 1, 'totalEntries' => '1234', 'totalPages' => '13' }

Documentation for specifying Page and Per Page information to API: http://developer.ebay.com/DevZone/finding/CallRef/findItemsByKeywords.html#page

Documentation for paginationOutput: http://developer.ebay.com/DevZone/finding/CallRef/types/PaginationOutput.html

peppyheppy avatar Dec 22 '12 21:12 peppyheppy