How I would write the following curl POST method using R and the RCurl package?
curl -k -u myusername:mypassword -d \'{\"text\":\"Hello World!\",\"level\":\"Noob
In RCurl, there's a function called postForm(), which is what you'd want to use. My generic example:
library(RCurl)
param1 <- "json"
param2 <- "all"
param3 <- "j3kn1kn41" # Hypothetical API token
webobj <- postForm("http://www.thewebsite.com/api/",type=param1,records=param2,token=param3)
Basically, you just pass any parameters you need as named arguments to postForm(), along with the base URL, and it constructs it and posts it, and puts the response into whatever object you declare (webobj) in this case.
If you need to set any curl options, you can use .opts=curlOptions(OPTIONS HERE)
to change them.