Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get activities from trello board

Tags:

trello

api

I have built a site that pulls the comments from Trello to show it on my site using this code:

    var resource = "cards/" + card.id + "/actions";
    Trello.get(resource, function(comments) {
            if(!$.isEmptyObject(comments)){
                    var commentStr="<div class='comments_c'>";
                    $.each(comments, function(c, cda){
                            //console.log(cda.data.text);
                            commentStr += "<p>"+cda.data.text+"</p>";
                            //addComments(cda.data.text);
                    });

                    commentStr += "</div>";
            }
            console.log(commentStr);

Now it works fine to pull the comments but it doesn't show the activity like "Sarah Hastings added this card to ". The api documentation doesn't talk about it and I am at a dead-end. We need it for reporting and looking for a way to get the activities (copied, moved, added) from Trello to our site. Any help is appreciated.

like image 818
FELASNIPER Avatar asked Sep 26 '22 03:09

FELASNIPER


1 Answers

By default, the cards/[idCard]/actions endpoint returns actions filtered to commentCard,updateCard:idList. If you want to get actions of additional types from that endpoint you will want to include the filter parameter with the list of action types that you want returned. You can see the full list of options documented here: https://developers.trello.com/advanced-reference/card#get-1-cards-card-id-or-shortlink-actions by clicking Show next to Arguments for that call.

For example actions of adding cards to a board would be of type: moveCardToBoard so you would want to add that to the filter parameter.

like image 68
Matt Cowan Avatar answered Oct 03 '22 15:10

Matt Cowan