question

purekrome avatar image
0 Likes"
purekrome asked

Is the findItemsByKeywords API broken when it returns the response as JSON?

I'm playing around with searching ebay using the `findItemsByKeywords` endpoint. My request is in XML (HTTP GET) with the response in JSON. When I see the results, I've noticed that most of the values (remember json is key/value) are in `array`'s ??!!! This seems crazy / wrong / broken ? Lets have a look at some sample JSON which was just returned... { "findItemsByKeywordsResponse": [ { "ack": [ "Success" ], "version": [ "1.13.0" ], "timestamp": [ "2016-08-21T08:48:26.317Z" ], "searchResult": [ { "@count": "1", "item": [ { "itemId": [ "162175863830" ], "title": [ "Sealed/Unlocked Apple iPhone 6s - 64GB - Silver Smartphone" ], .. snipped ... } ] } ], "paginationOutput": [ { "pageNumber": [ "1" ], "entriesPerPage": [ "1" ], "totalPages": [ "4" ], "totalEntries": [ "4" ] } ], "itemSearchURL": [ " http://www.ebay.com.au/sch/i.html?_nkw=iphone+6s&fscurrency=AUD&_ddo=1&_ipg=1&_mPrRngCbx=1&_pgn=1&_sop=1&_udhi=100" ] } ] } (of course, heaps snipped out .. but you get the point). Ok. so starting with the root key/values... key: `findItemsByKeywordsResponse` value: An _array_ of .. a response object.. key: `ack` value: an _array_ of values ... with `Success` being the only result in this array. This is .. like .. so wrong?? **All the values are inside an [ ] Array, instead of just being a simple string or number.** With the odd exception, this is bad/wrong IMO. It should be like this.. { "findItemsByKeywordsResponse": { "ack": "Success", "version":"1.13.0", "timestamp": "2016-08-21T08:48:26.317Z", "searchResult": { "count": 1, "item": [ { .. first item .. } ... ] } } etc. So the `findItemsByKeywordsResponse` has only one object result in there. Inside this single object we have `ack`, `version`, etc.. which are single key/vals. When then get to `searchResult` (also a single value) which has our first _array_ : `item`. This is a list of items (0 to many). So .. is there something -seriously- wrong with the JSON response format?
apifinditemsbykeywordsjsonfinditemsbykeywordsresponse
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.