I’m trying to use R to conduct searches in eBay on the site’s API. However, I’m at a complete loss as to how to do this.
I’m familiar with using other APIs in R, e.g. Twitter and Instagram. Some of these searches can be conducted using dedicated libraries (twitteR, streamR, etc.), but I’ve also had to cobble stuff together with httr and RCurl. Unfortunately, I’m having absolutely no luck with such approaches on ebay. I’ve tried:
getURL(''http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords
&SERVICE-VERSION=1.0.0
&SECURITY-APPNAME=My_App_ID
&GLOBAL-ID=EBAY-US
&RESPONSE-DATA-FORMAT=JSON
&callback=_cb_findItemsByKeywords
&REST-PAYLOAD
&keywords=harry%20potter
&paginationInput.entriesPerPage=3')
It didn’t work. I also tried:
url <- "http://svcs.ebay.com/services/search/FindingService/v1"
xml.request <- "<?OPERATION-NAME=findItemsByKeywords
&SERVICE-VERSION=1.0.0
&SECURITY-APPNAME=My_App_ID
&GLOBAL-ID=EBAY-US
&RESPONSE-DATA-FORMAT=XML
&callback=_cb_findItemsByKeywords
&REST-PAYLOAD
&keywords=harry%20potter
&paginationInput.entriesPerPage=3>"
myheader=c(Connection="close",
'Content-Type' = "application/xml",
'Content-length' =nchar(xml.request))
data = getURL(url = url,
postfields=xml.request,
httpheader=myheader,
verbose=TRUE)
No luck with this either. Basically, I have no idea what I’m doing. Can anyone help?
2
Answers
Reference Getting Started with the Finding API: Finding Items by Keywords
I have wrapped ebay’s Finding API with a new R package called
ebayr
, with ahttr::GET
call. See here: https://github.com/gsimchoni/ebayrYou’ll need to get your token from https://go.developer.ebay.com/ and you’re good to go.
Here’s also a blog post for inspiration: http://giorasimchoni.com/2017/12/19/2017-12-19-e-is-for-elephant-the-ebayr-package/