Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trello api returning incorrect results

Tags:

trello

Using the following code snippet

var url = "https://api.trello.com/1/boards/502b9bff1f4564a45db0f34d/?lists=open&list_fields=all&cards=open&card_fields=name,desc,idList,idShort,closed&key=<appropriate key>&token=<appropriate token>";

var response = UrlFetchApp.fetch(url);
var trelloStuff = Utilities.jsonParse(response.getContentText());
var cards = trelloStuff.cards;

instead of getting 42 cards I get 254 cards. I have the result in JSON if required.

The cards I want (the real cards on this board) are at the end of the JSON. The first set of cards (unwanted and not of this board) are named 'Card 1' to 'Card 9' and 'Card A' to 'Card F'.

There are no archived cards on the board, but there are a few archived lists that may or may not have had cards attached before archiving.


1 Answers

Instead of requesting cards=open use cards=visible.

This should only return cards that you can see when you look at the board (as opposed to cards that are "open" but in a list that has been archived)

like image 119
Daniel LeCheminant Avatar answered Jul 11 '26 21:07

Daniel LeCheminant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!