如何使用带有以下参数的 RCurl

How to use RCurl with the following parameters

我需要知道如何使用 RCurl 编写此参数:

curl -v -X PUT -H "X-IBM-Client-Secret:YOUR_CLIENT_SECRET" -H "X-IBM-Client-Id:YOUR_CLIENT_ID" -H "Content-Type: application/json" -d '{"clientName": "The Sample Outdoors Company", "redirectURIs": "https://example.com:5443", "ownerName": "John Smith", "ownerEmail": "John.Smith@example.com", "ownerCompany": "example.com", "ownerPhone": "555-123-4567"}' https://api.ibm.com/watsonanalytics/run/oauth2/v1/config

非常感谢你的帮助。

你可以这样使用它:

library(RCurl)
library(RJSONIO)

httpPUT("https://api.ibm.com/watsonanalytics/run/oauth2/v1/config",
        content = toJSON(list('clientName' = "The Sample Outdoors Company", 'redirectURIs' = "https://example.com:5443", "ownerName" = "John Smith", "ownerEmail" = "John.Smith@example.com", "ownerCompany" = "example.com", "ownerPhone" = "555-123-4567")),
        .opts = list(httpheader = c('Content-Type' = 'application/json', 'X-IBM-Client-Secret' = 'YOUR_CLIENT_SECRET', 'X-IBM-Client-Id' = 'YOUR_CLIENT_ID')))

您可以只传递一个字符串,而不是 toJSON