【发布时间】:2016-10-12 05:19:01
【问题描述】:
所以我终于让我的 ping 命令使用 httr 作为下面的脚本工作
library(httr)
curl_com = GET("https://api.rosette.com/rest/v1/ping", add_headers(`X-RosetteAPI-Key` = "my api"))
很棒的东西,但现在因为我卡在了下一点。
现在我想调用另一个api来做情绪分析
curl -X POST \
-H "X-RosetteAPI-Key: your_api_key" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Cache-Control: no-cache" \
-d '{"content": "Original Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, couldn’t be more pleased with the new all-female Ghostbusters cast, telling The Hollywood Reporter, “The Aykroyd family is delighted by this inheritance of the Ghostbusters torch by these most magnificent women in comedy.”" }' \
"https://api.rosette.com/rest/v1/sentiment"
我收到错误 405 - Method Not Allowed - 您尝试使用无效方法访问 Rosette API。我不知道如何使用 httr 翻译上面的 curl 命令,有人可以一步一步告诉我吗?
希望有人可以帮忙 佩迪
【问题讨论】:
-
您知道 Rosette 的 API 有一个 R package,对吧?