Search code examples
sortingebay-api

Ebay API SortOrder not working


I am using the Ebay API to fetch some results. I would like to sort the results by price and shipping price, highest first, but the following query doesn't seem to be working correctly.

Can somebody please tell me why the results are not sorted by price + shipping highest?

http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME={appid}&GLOBAL-ID=EBAY-US&keywords=my+little+pony&paginationInput.entriesPerPage=150&sortOrder=PricePlusShippingHighest

I am getting results:

*"title":"Rare Greek My Little Pony G1 Baby Glory MLP with Buggy by el greco MIP"
"shippingServiceCost":"24.99"
"currentPrice":"2999.99"*
**=$3024.98**

*"title":"Vintage Buggy Greek My Little Pony G1 Baby Green Hair  Minty Chloe Rare MLP NIB "
"shippingServiceCost":"25.0"
"currentPrice":"1781.97"*
**=$1806.97**

*"title":"My little pony Greek baby pink Moondancer El Greco"
"shippingServiceCost":"0.0"
"currentPrice":"1600.0"*
**=$1600.00**

*"title":"My Little Pony toys"
"shippingServiceCost":"0.0"
"currentPrice":"1500.0"*
**=$1500.00**

*"title":"Vintage 1987 MY LITTLE PONY PRESSBOOK Spec Book Pre-Production PROTOTYPE INFO"
"shippingServiceCost":"0.0"
"currentPrice":"1500.0"*
**=$1500.00**

*"title":"IDW 1st Edition Box Set My Little Pony Issue 1 Covers A-F Signed\/Autographed"
"shippingServiceCost":"0.0"
"currentPrice":"1200.0"*
**=$1200.00**

*"title":"Vintage Hasbro My Little Pony MLP Huge Lot 100+ Ponies Accessories "
"shippingServiceCost":"29.95"
"currentPrice":"995.95"*
**=$1025.90**

*"title":"Elope My Little Pony Rainbow Dash Tail"
"shippingServiceCost":"0.0"
"currentPrice":"1000.0"*
**=$1000.00**

*"title":"My Little Pony lot of 6 Sea ponies year 3 (1984) Vintage with stickers"
"shippingServiceCost":"5.0"
"currentPrice":"985.41"*
**=$990.41**

*"title":"My Little Pony G1 Prototype Birthflower June Rose OOAK Rare One of a Kind"
"shippingServiceCost":"0.0"
"currentPrice":"949.99"*
**=$949.99**

*"title":"WACKY PACKAGES 1991 ORIGINAL ART PAINTING MY SPITTLE PONY MY LITTLE PONY"
"shippingServiceCost":"0.0",
"currentPrice":"900.0"*
**=$900.00**

*"title":" Super Rare Italian White Peachy\/Snuzzle My little Pony Italy! VHTF"
"shippingServiceCost":"15.0"
"currentPrice":"850.0"*
**=$865.00**

*"title":"My Little Pony Trading Cards Series 1 COMPLETE SET **All cards, all promos**"
"shippingServiceCost":"0.0"
"currentPrice":"800.0"*
**=$800.00**

*"title":"My Little Pony funko figure lot chase sdcc Celestia Discord Derpy DJ Pon3 more"
"shippingServiceCost":"0.0"
"currentPrice":"800.0"*
**=$800.00**

*"title":"Comic Con SDCC 2011 My Little Pony Applejack Motivational Poster LE 50 Rare!"
"shippingServiceCost":"0.0"
"currentPrice":"799.99"*
**=$799.00**

*"title":"My Little Pony Trading Cards Series 1 Complete Set"
"shippingServiceCost":"31.67"
"currentPrice":"600.0"*
**=$631.67**

*"title":"PC1 My Little Pony ~*ULTRA RARE Special Mail Offer PINK Sprinkles STUNNING!*~"
"shippingServiceCost":"13.95"
"currentPrice":"693.98"*
**=$707.93**

*"title":"Milky Way The milk mare MLP My little Pony Plush With Boobs RARE"
"shippingServiceCost":"0.0"
"currentPrice":"700.0"*
**=$700.00**

*"title":"My Little Pony Trading Cards - Series 3 NEARLY COMPLETE!!!!!","listings":[{"itemId":"131632602421",
"shippingServiceCost":"0.0"
"currentPrice":"700.0"*
**=$700.00**

*"title":"Lot 2 MLP Box My Little Pony G1 Greek El Greco 1980 Baby Bowtie Cotton Candy"
"shippingServiceCost":"16.0"
"currentPrice":"650.0"*
**=$665.00**

Solution

  • It's because items are first grouped and then sorted. The documentation states:

    Sorts items by the combined cost of the item price plus the shipping cost, with highest combined price items listed first. Items are returned in the following groupings: highest total-cost items (for items where shipping was properly specified) appear first, followed by freight- shipping items, and then items for which no shipping was specified. Each group is sorted by price.

    The changing of the order within the results will be an indication that a new grouping has started.