knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Go to https://developers.pinterest.com/apps/
and register a new app. In this new app, use https://colinfay.me/rpinterestcallback/
as a callback URL. You can also use a custom callback if you build your own. Read the Vignette "rpinterest-oauth" for more info about the why and the how.
Once your app is set, use pinterest_token to create a token:
token <- pinterest_token( app = "yourapp", app_id = "yourappid", app_secret = "yourappsecret" )
You'll be taken to a Pinterest login page and R will be waiting for a connection code. After login, https://colinfay.me/rpinterestcallback/
will contain a code that you'll need to paste back to R.
If your pinterest app is unauthorised, you'll be granted 10 requests per hour per token.
Get information about your account :
get_logged_user()
, get_logged_user_boards()
, and get_logged_user_boards_suggestions()
return informations about yourself. create_board()
creates a board on your account, with a name and a description.create_pin()
creates a pin on one of your board, with a name and a description, from a local file.delete_board()
delete a board on your account.delete_pin()
delete on one of your pin.edit_board()
edit a board on your account, with a name and a description.edit_pin()
creates a pin on one of your board, with a name and a description, from a local file.ggplot_to_pinterest()
sends a ggplot2 object to a Pinterest Board. Note that {ggplot2}
has to be installed to run this command.
library(ggplot2) x <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point() ggplot_to_pinterest(x, "colinfay/gris-mon-amour", "test rpinterest", token = token)
Get all the pins from a board:
get_board_pins_by_id(id = "42080646457333782", token = token)
get_board_pins_by_name(user = "colinfay", board = "blanc-mon-amour", token = token)
get_board_spec_by_id(id = "42080646457333782", token = token)
get_board_spec_by_name(user = "colinfay", board = "blanc-mon-amour", token = token)
get_pin_spec_by_id(id = "42080577745042298", token = "your_token")
get_user_spec_by_id(id = "42080715176677612", token = token)
get_user_spec_by_name(user = "colinfay", token = token)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.