Get Checklist Items via Powerup Client API

I am working on a powerup to visualize boards a certain way. I am able to call t.lists(‘all’) and get all lists and cards. I can also call t.cards(‘all’). However, each card object does not have checklists. Is there any way via the Client API to get checklist items? If not, why not? This seems like it would be very useful.

I’m fairly certain I could use REST API, but would like to avoid that complexity if possible.

:thinking: You’re right, we don’t offer checklists as an option for t.card (https://developers.trello.com/reference#t-card).

That seems like a reasonable addition that we should be able to make. Let me talk to the team and see if we can’t get that prioritized!

You can definitely do this via the API, but it seems reasonable to expect this from the Power-Up Client library as well.

So I’ve explored this a little bit more and, unfortunately, it isn’t an easy addition as it stands.

Here is why: Trello’s web client keeps a local cache of data it needs to render Trello boards. When you first load a board, it asks the API for all of the cards on the board and all of the things it needs to render a board-level view. It stores that data in its local cache and uses it as needed. The majority of what is available in the client library for Power-Ups is being pulled from what is in that cache. However, the cache doesn’t get the checklists for a card until it needs them - when you’re looking at a card back. So we could give you incomplete data - just pass along what we already know about in the cache. Or we could make a new request to the API asking for the checklists. This gets into a place where we need to understand the impact of making a new request for data on your Power-Up’s behalf and the impact it could have on the load performance of a board.

We don’t have a solid answer on how we’d want to implement this yet, but it isn’t something we’ve said we will never do. Our team will keep it in the backlog, but right now it isn’t something that is highly prioritized.

Our recommendation at this time is that you should use the REST API to get checklists.

I’ve come across what I think is a similar issue, trying to use the Power-Up client api to get the comments (“commentCard actions”) for a card from a card-button. t.card() can be used to find the count of comments for the card, but can’t retrieve the actual text of the comment. This means having to also use client.js - and doing so means the member needs to authorize the button so I can get a token to use with the REST API. That’s a rather inconvenient process for the end user.

Authorizing the Power-Up to access the comments seems like overkill, since the button is on the card back and all comments are already visible to the member. Maybe I’ve misunderstood something, but it would be much more convenient if t.card() could accept ‘actions’ or even just ‘commentCard’ parameter and return that data. From your description above, it would seem that the Trello web client would have already retrieved/cached that info in order to display the card back.

Because of the situation I described above, would you be OK with an implementation that only returned checklists/comments if you were in the context of a card back? And if you weren’t we returned an error or warning?

Not sure about majormojo’s case, but in my use case, I’m presenting visualizations such as a simple bullet list or bar chart based on all the lists, cards, and checklist items. So it really has to be on board context for me. I’ve done proof-of-concept already in REST, but am looking to build that REST-based solution into a powerup.

One thing I’m not clear on is why the Powerup authorization can’t include some level of REST token. That’s the part that’s a little strange IMO - if I understand right, the user has to authorize the Powerup once, then again to allow REST. If there were a ‘capability’ switch for ‘Read Board via REST’, and then I could get and use that token via client-side javascript, without having to do another OAuth flow, then that would probably accomplish what I need.

Yes, that would work just fine; it would be a nice improvement. Thx

Totally hear you on this one. Something we’ve spent a lot of time talking and thinking about internally. Nothing on the horizon yet, but I’ll certainly add your comment and thoughts to the feedback we’ve collected.


@majormojo Let me explore the possibility of the card-back only version and see if it is something that is easy enough to implement we can give it a try. I’ll report back in a few days!

Thanks.

Just to elaborate on my use case in case it’s helpful for others, what I need to do is to get all the comments created for a card so I can download and archive them in a separate document for record keeping. We use Trello in a medical/legal context and need to keep a record of our notes for each card in a long-term data store with other client documents after the card has been archived or deleted in Trello.

Whether a call to retrieve those comments returns an error or an empty record, either is fine as I’ll check for that and take the appropriate action.