Trello API:如何获得组织或成员的董事会ID

时间:2015-07-22 08:42:24

标签: javascript coffeescript trello

我正在研究一个基于GitHub的Trello同步僵尸程序:https://github.com/fiatjaf/trello-cardsync我正在处理coffeescript文件。我已经查看了API,我想我知道我需要什么,我只是不知道如何准确地编写它,我无法找到它的任何例子,尤其是在coffeescript(或javascript)中。

我希望能够搜索组织板或会员板,然后选择某些板ID,这样我就可以得到我想要的某些板卡的板ID列表,这样我就可以为这些板创建webhook了。

我尝试使用Trello.get("members/me/boards", { fields: "id, name"})获取所有主板ID和名称,例如client.js API' Trello.get(路径[,参数],成功,错误)&# 39;但是当我尝试将它打印到控制台时,我的GET只返回unidentified。我在settings.coffee文件中有一组对象来比较名称以选择我想要的板,但我无法在我的文件中获得完整列表。目前我只是查看链接中的数据:https://trello.com/1/members/my/boards?key=substitutewithyourapplicationkey&token=substitutethispartwiththeauthorizationtokenthatyougotfromtheuserand手动输入ID以创建webhook,但我希望尽可能自动化。

我还看过' GET / 1 / search'在Trello API中,但我不确定如何在我的coffeescript文件中执行此操作。

1 个答案:

答案 0 :(得分:1)

您需要将回调传递给Trello.get。它没有返回任何有意义的内容,而是将值传递给回调函数:

Trello.get("members/me/boards", { fields: "id,name"}, function(err, boards) {
  console.log(boards); // got them!
  console.log(err); // if something went wrong, this will be non-null
})
相关问题