TODAYDOUGLEARNED is a place where I can dump my brain, muse, complain, and otherwise contribute to the greater project of aggregating human knowledge in a world wide web.

If you’re here for Trello API basics…

I’m going to skip over a lot of the introductory stuff about the Trello API – if you want to read more about the basics, you’ll want to read their Trello API Introduction.

What am I working on?

I’m digging into a project where I want to pull Trello data into a Redshift warehouse and then query it using Sisense for Cloud Data Teams (formerly Periscope). My primary objective is retrieving card data, although the results of this first task will undoubtedly uncover additional similar tasks.

When you read Trello’s API docs, they make it abundantly clear up front that *everything is nested*.


Since everything is nested, and there are so many *relationships* between objects, there are many *methods* to retrieve data. Put another way, there are different *lenses* you can use to view objects. And the request URLs you use are the key to retrieving data in these different ways.

Case in point – retrieving card data.



So, it’s like there’s a direct URL (URL params) to a card or cards, or even fields in those cards.:

“Show me this board, and the cards in this board, and these fields in these cards.”

But then there’s a different URL (query params) that allow you to ask a question:

“Show me this board, and cards in this board where conditions x, y, and z are true.”

The only way I’ve been able to wrap my head around this is to make requests both ways and see what kind of response is returned.

URLs and their responses

Query params

Let’s start with a URL using query params:{{board}}/?cards=all&card_fields=name,idShort,dateLastActivity&card_modifiedSince=2020-03-22T20:03:04.339Z

In this query, I’m asking for specific fields from all cards from a specific board that were modified since a certain datetime.

The response gives me several things:

  1. Information about the board. I didn’t ask for this, but apparently Trello is going to give it to me anyway. The first 98 lines of my prettified JSON response tell me the board ID, name, URL, short URL, preferences, styles, labels, etc.
  2. Information about the cards. I did ask for this, and Trello gives me exactly what I asked for.

cards 1

Okay, great. That’s one way to get the information I need – use query params to ask a question and get an answer.

URL params

Now, let’s look at what they call URL params – the direct approach, rather than the question approach:{{board}}/cards?filter=all&fields=name,idShort,dateLastActivity&since=2020-03-22T20:03:04.339Z

Rather than viewing this as a question, I’m kind of pointing to the cards directly. I want specific fields from all cards from a specific board where the card was created after a certain datetime.

Note that last bit – when you use URL params, card_modifiedSince is *not* one of the parameters you can use. You have to use before or since, which only references the creation date of the card. Again, different lenses looking at the same data.

The response gives me those specific card fields:

cards 2

Long story made short…

It’s up to you which method you use to request data from Trello’s API. You have to be careful to know which *lens* you’re trying to look through. For the purposes of my project, I’m going to stick with the query params. I only have one board and I want to know when a card was last updated in order to determine whether or not to get its data.

Have you used Trello’s API? Can you better summarize the difference between query params and URL params? What has made the most sense for you? I’d love to hear your feedback.


2 responses to “Cards as Nested Resources in the Trello API”

  1. Joseph Avatar

    Man, you absolutely SAVED my evening. I was flailing against their rest api for a good hour before I finally came across this blog post and saw what Atlassian’s documentation SHOULD have: definitions of what the parameters do and clear working examples that USE them.


    1. Doug Avatar

      I’m glad this post helped!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: