1

Im trying to download transactions from eBay POST API ,attached eBay documentation : eBay Documentation

im trying to run the following script

    ebay_url <-"https://publisher.ebaypartnernetwork.ebay.com/PublisherReportsTx"
user_name <- "xxxxxxx"
user_password <- "yyyyyyy"
pt <- "1"
tx_fmt <- "0"
submit_tx <-"Download"

from_date <- Sys.Date()-5
to_date <- Sys.Date()-1

## POST request Access Token



response <- POST(url = paste0(ebay_url,
                              "?user_name=",user_name,
                              "&user_password=",user_password,
                              "&start_date=",from_date,
                              "&end_date=",to_date,
                              "&pt=",pt, 
                              "&tx_fmt=",tx_fmt,
                              "&submit_tx=",submit_tx),
                 content_type("application/x-www-form-urlencoded"))

im receiving status 200 but i dont know how to pull the data from that call

usually im using fromJSON or response[["content"]] in GET calls but its not working here ,

user3600910
  • 2,839
  • 4
  • 22
  • 36
  • 3
    Assuming data is being returned, then the `content()` function should work. For example `r <- POST("http://httpbin.org/post", body = list(a = 1, b = 2)); content(r)`. – MrFlick Aug 22 '18 at 18:21
  • thanks, but i didn't fully understand what should i put in the body the documentation didnt mention anything about that – user3600910 Aug 22 '18 at 19:11
  • I just grabbed that from the `?content` help page. There doesn't have to be a body if the API doesn't require it. You can also do `r <- POST("http://httpbin.org/post"); content(r)`. But it all depends on what the server itself returns. – MrFlick Aug 22 '18 at 19:31
  • when im using content(response) i received: {xml_document} [1] \n – user3600910 Aug 22 '18 at 19:53
  • 3
    Sounds like you are getting an HTML page back that probably has an error message in it. But without some sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), it's not going to be easy to help you with that. – MrFlick Aug 22 '18 at 19:58

0 Answers0