update_resource: Update Resources

Description Usage Arguments Details Examples

View source: R/update_resource.R

Description

Update resources via Trello API.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
update_resource(
  resource,
  id = NULL,
  path = NULL,
  body = NULL,
  token = NULL,
  on.error = c("stop", "warn", "message"),
  verbose = FALSE,
  handle = NULL,
  encode,
  response
)

Arguments

resource

Model name, eg. "card".

id

Model id.

path

Path.

body

A named list.

token

An object of class "Trello_API_token", a path or NULL.

  • If a Token, it is passed as is.

  • If NULL and a cache file called ".httr-oauth" exists, the newest token is read from it. If the file is not found, an error is thrown.

  • If a character vector of length 1, it will be used as an alternative path to the cache file.

on.error

Behavior when HTTP status >= 300, defaults to "stop".

verbose

Whether to pass httr::verbose() to httr::RETRY().

handle

Passed to httr::RETRY().

encode, response

Deprecated.

Details

See Trello API reference for more info about what elements can be included in PUT request body.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## 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 cards and extract ID of the first one
cid = get_board_cards(bid, token)$id[1]

# Content for the new card
payload = list(
  id = cid,
  name = "A new card name",
  desc = "Description - updated by trelloR",
  pos = "top" #put card on the top of a list
)

# Update card's name, descriptionand position
update_resource("card", id = cid, body = payload, token = token)

## End(Not run)

trelloR documentation built on April 22, 2021, 1:07 a.m.