简体   繁体   English

如何通过以下参数使用RCurl

[英]How to use RCurl with the following parameters

I need to know how to write this parameters with RCurl: 我需要知道如何使用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

I really appreciate your help. 非常感谢您的帮助。

You can use it like this: 您可以像这样使用它:

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')))

Instead of toJSON you can pass just a string. 可以只传递一个字符串,而不是toJSON

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM