Reputation: 77
I would like to translate the following HTTP GET command to work with RCurl:
curl -G https://api.example.com/resource \
-d "param=value" \
-d "param=value" \
-u 'user:password'
Here is my attempt using getURL in RCurl:
getURL("https://api.example.com/resource",
userpwd ="username:password",param="value",param="value")
The first code block works fine in my command line terminal and I have no troubles using getURL until I try to set parameters; I get warning messages saying that the params are "Unrecognized CURL options". Any ideas?
Upvotes: 2
Views: 1888
Reputation: 44555
Anything going to the ...
argument is interpreted as a curl option. You need to put parameters as a list in the httpheader
argument. See documentation.
Try something like:
getURL("https://api.example.com/resource",
userpwd ="username:password",
httpheader=list(param1="value",param2="value"))
Upvotes: 3