22

is there a way to get all the comments of a card through the Trello API? I can get the card, the list which it is in, the members assigned to it etc. but can't see a way to get the comments.

Thanks.

hyp
  • 1,370
  • 1
  • 9
  • 21

4 Answers4

24

Comments are a type of action ("commentCard"), so look into the /card/:id/actions

Daniel LeCheminant
  • 50,583
  • 16
  • 120
  • 115
  • 1
    Thanks, will get that going with this, any chance of doing it a bit easier like /card/id/comments ? – hyp Apr 23 '12 at 08:37
  • Did you figure out if this works? I only see API calls for PUT/POST/DELETE comments. – Stan James Jan 31 '14 at 20:19
  • 6
    In Ruby, using the [ruby-trello](https://github.com/jeremytregunna/ruby-trello) gem, I'm able to get `commentCard` actions straight from a `Card` object with `comments = card.actions({filter: 'commentCard'})`. I *think* it still makes a separate HTTP request but it may make more sense to do this way if you already have an object on hand. I expect there are similar things you can do with other languages' APIs. – acobster Jul 23 '14 at 17:38
7

Try this API URL

Method: GET

https://api.trello.com/1/cards/{card_Id}/actions?filter=commentCard&key={trellokey}&token={trellotoken}

Mohit Rathod
  • 1,057
  • 1
  • 19
  • 33
Vikram
  • 110
  • 1
  • 8
2

GET /1/cards/[card id or shortlink]/actions

you'll get list of action-objects in json, each has its type, type for comment "commentCard", comment text in

object.data.text

https://trello.com/docs/api/card/index.html#get-1-cards-card-id-or-shortlink-actions

AlexisK
  • 111
  • 1
  • 2
0
Trello.actions.get(action.id + "/data", function() {})

seems to do it for me with client.js. Hope that helps :)

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
JoshuaWohle
  • 23
  • 1
  • 7