Skip to contents

This document explains how to add, update and delete resources via Trello API. This requires authentication, as explained here.

Creating and modifying resources

The create_resource() function allows you to create new boards, cards, lists and other resources. To create a new resource, specify its type (e.g. “card”) using the resource argument. Further details such as name or description must be passed as a named list using the body argument.

The following example creates a new card and places it at the bottom of a list (see the Trello API reference for query parameters):

library(trelloR)
payload = list(
  name = "My new card!", desc = "An example card.", 
  pos = "bottom",
  idList = list_id # get it by calling get_board_lists()
)
create_resource(model = "card", body = payload)

When successful, the request returns a named list of values describing the newly created resource, including its ID. This is very useful as you can immediately capture the ID if you need it.

The update_resource() function follows the similar logic, but can only be used with existing resources.

To delete resources, use delete_resource(), but beware: Deleted resources cannot be brought back!

Built with

sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
#>  [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
#>  [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
#> [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
#> 
#> time zone: UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.6.3       cli_3.6.1         knitr_1.43        rlang_1.1.1      
#>  [5] xfun_0.40         stringi_1.7.12    purrr_1.0.2       textshaping_0.3.6
#>  [9] jsonlite_1.8.7    glue_1.6.2        rprojroot_2.0.3   htmltools_0.5.6  
#> [13] ragg_1.2.5        sass_0.4.7        rmarkdown_2.24    evaluate_0.21    
#> [17] jquerylib_0.1.4   fastmap_1.1.1     yaml_2.3.7        lifecycle_1.0.3  
#> [21] memoise_2.0.1     stringr_1.5.0     compiler_4.3.1    fs_1.6.3         
#> [25] systemfonts_1.0.4 digest_0.6.33     R6_2.5.1          magrittr_2.0.3   
#> [29] bslib_0.5.1       tools_4.3.1       pkgdown_2.0.7     cachem_1.0.8     
#> [33] desc_1.4.2