Getting public data

collapse = TRUE,
comment = "#>"

This document explains how to interact with Trello from R with read-only access. For editing/private access, see Authorized access and Editing functions.


Most things in Trello live on a Board. A board encapsulates a hierarchy of resources: Members, Teams, Lists, Cards, Custom fields and Actions. Some of the resources may contain additional data (e.g. cards may have labels, due dates etc.) or other nested resources (e.g. boards may have lists, cards, label definitions etc.)

Each resource can have a parent resource (e.g. a board is a parent resource for a card) and child resources (a card can include actions as a child resource). A resource can have more than one parent (a board and a list are both parents to a card).

To access a resource, you need to know its unique ID, or the ID of its parent resource. In some cases (e.g. boards or cards), you can use the resource URL instead.

Getting data

The following snippet fetches 5 cards from the trelloR demo board. This is a public board and so does not require authentication:

board = ""
param = list(fields = "id,name,idList,labels")
cards = get_board_cards(board, query = param, limit = 5)

The result is a data.frame (or a tibble if installed):

cards[, 1:3]

Nested resources can be obtained by querying their parent resource. In the example above, we didn't have to query each card individually - instead, we just queried the board resource to get all of its cards.

A general way of retrieving data from a board is to use the function get_resource() which allows you to specify parameters of the query. However, trelloR also includes a number of wrappers for specific resources. For example:

The following example creates a wrapper to fetch updates to a given card. This is represented by the "updateCard" action type passed to filter:

get_card_updates = function(id, ...) {
  get_resource(parent = "card", child  = "actions", id = id,
               filter = "updateCard", ...)
card_updates = get_card_updates(cards[["id"]][4])
card_updates[, 1:5]

Error handling

If a request fails andretry.times > 1, it will be re-attempted. If it fails after all attempts are spent, the subsequent behavior is determined by the on.error argument.

error = get_card_actions(id = "wrong_id", on.error = "message")

Built with


Try the trelloR package in your browser

Any scripts or data that you put into this service are public.

trelloR documentation built on Aug. 28, 2023, 1:07 a.m.