| create_resource {trelloR} | R Documentation | 
Create Resources
Description
Create resources via Trello API.
Usage
create_resource(
  resource,
  id = NULL,
  path = NULL,
  body = list(name = "New"),
  token = NULL,
  on.error = c("stop", "warn", "message"),
  verbose = FALSE,
  handle = NULL,
  encode,
  response
)
Arguments
| resource | Model name, eg.  | 
| id | Model id. | 
| path | Path. | 
| body | A named list. | 
| token | An object of class  
 | 
| on.error | Behavior when HTTP status >= 300, defaults to  | 
| verbose | Whether to pass  | 
| handle | Passed to  | 
| encode,response | Deprecated. | 
Details
See Trello API reference for more info about what elements can be included in POST request body.
See Also
Other functions to create resources: 
add_board(),
add_card_attachment(),
add_card(),
add_checkitem(),
add_checklist(),
add_comment(),
add_label(),
add_list(),
add_member()
Examples
## Not run: 
# Get token with write access
key = Sys.getenv("MY_TRELLO_KEY")
secret = Sys.getenv("MY_TRELLO_SECRET")
token = get_token("my_app", key = key, secret = secret,
                  scope = c("read", "write"))
# Get board ID
url = "Your board URL"
bid = get_id_board(url, token)
# Get lists on that board, extract ID of the first one
lid = get_board_lists(bid, token)$id[1]
# Content for the new card
payload = list(
  idList = lid,
  name = "A new card",
  desc = "#This card has been created by trelloR",
  pos = "bottom"
)
# Create card and store the response (to capture the ID
# of the newly created resource)
r = create_resource("card", body = payload, token = token)
# Get ID of the new card
r$id
## End(Not run)