我一直在玩 httr 和 rcurl,但无法将以下 curl GET 请求转换为 R:
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer 31232187asdsadh23187' 'https://this.url.api.com:334/api/endpoint'
特别是,我在传递授权选项时遇到了一些麻烦,因为我无法在两个库中找到等效参数。可能是自定义 header ?
最佳答案
httr::GET('https://this.url.api.com:334/api/endpoint',
accept_json(),
add_headers('Authorization' = 'Bearer 31232187asdsadh23187'))
关于r - 在 R 中发起 GET 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35559913/