Reputation: 1702
There are variations on this in existing posts, but specifically for the Facebook API I'd like to be able to use cURL to POST photos to the API using R and store the returned ID.
An example would be:
curl -i -X POST \
-d "url=https://wheremyimageishosted.com/test_photo.png" \
-d 'published=false' \
-d "access_token=<my_access_token>" \
"https://graph.facebook.com/v2.10/me/photos"
And what is returned is in the format of:
{"id":"1234123412341234"} .
I know there are various packages for cURL for R, but they're not the easiest to understand for an R intermediate, but cURL beginner.
Thus, the two asks here are:
Thanks.
Upvotes: 0
Views: 332
Reputation: 1702
Not sure why someone would downvote me, but to answer my own question, I'd recommend the wonderful httr package for converting cURL into R. I've got it to work for a number calls to and from the Facebook API. The last stumbling block for me was to remember to use
encode = "json"
... where appropriate. Details are here:
https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html
Upvotes: 1