0

I'm trying to do a GET call to pull an inventory of numbers for a particular account from a website. However, when doing this call in R, I keep getting an error. See below:

url <- "https://examplewebsite.com/api/account/inventory"

response <- 
  GET(url = url)

Response:

Error in curl::curl_fetch_memory(url, handle = handle) : 
  Failure when receiving data from the peer

I am able to get the requested data through postman, so this appears to be an R/HTTR related issue. It was suggested to me that perhaps the request was timing out, but I added the timeout argument, without relief.

Additionally, the default max return on inventory numbers is 300. When I have tried to pull from an account with under 50 numbers, it works. However, if an account has an inventory that is at the max of 300, I get the above error message.

Any thoughts are appreciated. Thanks!

wnettles
  • 17
  • 5
  • I can't replicate this. I get an html page with "coming soon" on it. Is this the expected result? – Allan Cameron Nov 19 '20 at 16:24
  • Hey Allan, I apologize for that. That website was just made up, as the website I'm using is my work's, and no one external would be able to access it. – wnettles Nov 19 '20 at 16:36
  • Are you sure it's the exact same request? Is the postman request using any cookies from your interactive session? Without any sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) it's going to be very difficult to help you. – MrFlick Nov 19 '20 at 18:19

0 Answers0