简体   繁体   English

使用RCurl包构建脚本

[英]Structuring A Script Using RCurl Package

I've been using the command line to access API data from a vendor we use, but now the process has evolved to where I need to use R. I'm trying to use the RCurl package, but I'm having difficulty figuring out how to structure the request. 我一直在使用命令行从我们使用的供应商那里访问API数据,但是现在该过程已经发展到需要使用R的地方。我正在尝试使用RCurl包,但是我很难弄清楚如何构建请求。

The call in the command line looks like: 命令行中的调用如下所示:

curl api.sample.io/users/scroll -u 'dG9rOmU5NGFjYTkwXzliNDFfNGIyMF9iYzA0XzU0NDg3MjE5ZWJkZDoxOjABCD=': -H 'Accept:application/json' 

But I'm struggling to figure out how to put that together using the RCurl package. 但是我正在努力弄清楚如何使用RCurl包将它们组合在一起。

FYI - Yes, I have read the RCurl manual. 仅供参考-是的,我已阅读RCurl手册。

I considered down-voting since you did absolutely no research (you absolutely did not "read the RCurl manual") at all on either curl or processing web requests in R, but perhaps this will help others who at least did basic searches. 我考虑过否决投票,因为您完全没有对R上的curl或处理Web请求进行任何研究(您绝对没有“阅读RCurl手册”),但这也许会帮助至少进行过基本搜索的其他人。

library(httr)

GET("http://api.sample.io/users/scroll",
    authenticate('dG9rOmU5NGFjYTkwXzliNDFfNGIyMF9iYzA0XzU0NDg3MjE5ZWJkZDoxOjABCD=', ""),
    accept_json())

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

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