list Trello API:获取板/列表/卡片信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26552278/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Trello API: getting boards / lists / cards information
提问by Juan Fco. Sierra
Using Trello API: - I've been able to get all the cards that are assigned to a Trello user - I've been able to get all the boards that are assigned to an Organization
使用 Trello API: - 我已经能够获得分配给 Trello 用户的所有卡片 - 我已经能够获得分配给组织的所有板
But I can't get any API call that returns all the lists that are in an Organization or User. Is there any function that allows that ?
但是我无法获得任何返回组织或用户中所有列表的 API 调用。有没有允许这样做的功能?
Thanks in advance
提前致谢
采纳答案by matthew-parlette
I don't believe there is a method in the Trello APIto do this, so you'll have to get a list of boards for a user or organization:
我不相信Trello API 中有一种方法可以执行此操作,因此您必须获取用户或组织的板列表:
GET /1/members/[idMember or username]/boards
GET /1/members/[idMember 或用户名]/boards
Which returns (truncated to show just the parts we care about):
返回(截断以仅显示我们关心的部分):
[{ "id": "4eea4ffc91e31d1746000046", "name": "Example Board", "desc": "This board is used in the API examples", ... "shortUrl": "https://trello.com/b/OXiBYZoj" }, { "id": "4ee7e707e582acdec800051a", "name": "Public Board", "desc": "A board that everyone can see", ... "shortUrl": "https://trello.com/b/IwLRbh3F" }]
[{ "id": "4eea4ffc91e31d1746000046", "name": "Example Board", "desc": "This board is used in the API examples", ... "shortUrl": "https://trello.com/b/OXiBYZoj" }, { "id": "4ee7e707e582acdec800051a", "name": "Public Board", "desc": "A board that everyone can see", ... "shortUrl": "https://trello.com/b/IwLRbh3F" }]
Then get the lists for each board:
然后获取每个板的列表:
GET /1/boards/[board_id]/lists
Which returns (truncated to only show the list id and name:
返回(被截断以仅显示列表 ID 和名称:
[{ "id": "4eea4ffc91e31d174600004a", "name": "To Do Soon", ... }, { "id": "4eea4ffc91e31d174600004b", "name": "Doing", ... }, { "id": "4eea4ffc91e31d174600004c", "name": "Done", ... }]
[{ "id": "4eea4ffc91e31d174600004a", "name": "To Do Soon", ... }, { "id": "4eea4ffc91e31d174600004b", "name": "Doing", ... }, { "id": "4eea4ffc91e31d174600004c", "name": "Done", ... }]
And go through this response for each board to build a list of all the lists a user or organization has.
并针对每个董事会完成此响应以构建用户或组织拥有的所有列表的列表。
回答by edelans
For the users who want the easiest way to access the id of a list :
对于想要以最简单的方式访问列表 ID 的用户:
Use the ".json" hack !
使用“.json”黑客!
add ".json" at the end of your board URL to display the same output of the API query for that board, in your browser! (no other tool needed, no hassle dealing with authentication).
在您的板 URL 末尾添加“.json”以在浏览器中显示该板的 API 查询的相同输出!(不需要其他工具,无需处理身份验证)。
For instance, if the URL of your board is :
例如,如果您的板的 URL 是:
https://trello.com/b/EI6aGV1d/blahblah
point your browser to
将您的浏览器指向
https://trello.com/b/EI6aGV1d/blahblah.json
And you will obtain something like
你会得到类似的东西
{
"id": "5a69a1935e732f529ef0ad8e",
"name": "blahblah",
"desc": "",
"descData": null,
"closed": false,
[...]
"cards": [
{
"id": "5b2776eba95348dd45f6b745",
"idMemberCreator": "58ef2cd98728a111e6fbd8d3",
"data": {
"list": {
"name": "Bla blah blah blah blah",
"id": "5a69a1b82f62a7af027d0378"
},
"board": {
[...]
Where you can just search for the name of your list to easily find its id next to it.
您只需搜索列表名称即可轻松找到其旁边的 ID。
tip: use a json viewer extension to make your browser display a nice json. Personnally I use https://github.com/tulios/json-viewer/tree/0.18.0but I guess there are a lot of good alternatives out there.
提示:使用 json 查看器扩展使您的浏览器显示一个漂亮的 json。我个人使用https://github.com/tulios/json-viewer/tree/0.18.0但我想那里有很多不错的选择。
回答by safi eddine
to get all your boards use
让你所有的板子都用上
Trello.get("/members/me/boards")
worked for me using client.js
使用client.js对我来说有效
回答by André Heller
You can do it by calling
你可以通过调用
GET /1/organizations/[idOrg]/boards?lists=all
GET /1/organizations/[idOrg]/boards?lists=all
It is here: https://developers.trello.com/advanced-reference/organization#get-1-organizations-idorg-or-name-boards
它在这里:https: //developers.trello.com/advanced-reference/organization#get-1-organizations-idorg-or-name-boards
Look at the arguments.
看看论据。
There are several filters and fields. You can customize it.
有几个过滤器和字段。您可以自定义它。