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
Let’s start with a URL using query params:
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:
- 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.
- Information about the cards. I did ask for this, and Trello gives me exactly what I asked for.
Okay, great. That’s one way to get the information I need – use query params to ask a question and get an answer.
Now, let’s look at what they call URL params – the direct approach, rather than the question approach:
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:
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.
Leave a Reply