2

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?

1
  • posted my RCurl attempt. Commented Oct 7, 2013 at 1:37

1 Answer 1

3

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"))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.