问题描述
我想为一个木板执行所有操作,但是Trello将结果限制为1000.我知道正确的处理方法是分页.我已经尝试将before
和page
用作关键字:
I want to get all the actions for a board, but Trello limits the results to 1000. I understand the correct way to deal with this is to paginate. I've tried both before
and page
as keywords:
基本通话:
https://api.trello.com/1/board/[boardID]/
?key=[key]&token=[token]
&actions=commentCard&actions_limit=1000
替代项:
Before
:
Before
:
https://api.trello.com/1/board/[boardID]/
?key=[key]&token=[token]
&actions=commentCard&actions_limit=1000&
before=[oldest_returned_action's_date]
Page
:
Page
:
https://api.trello.com/1/board/[boardID]/
?key=[key]&token=[token]
&actions=commentCard&actions_limit=1000&
page=[page_number]
结果永远不会改变---我总是得到[限制]个操作数,无论调用什么,它们总是相同的.我检查了返回日期中的日期,他们当然不尊重before
参数.我什至试图降低限额,以确保我没有试图返回比自己拥有的更多的东西.问题仍然存在.
The result never varies --- I always get back [limit] number of actions, and they're always the same no matter the call. I checked the dates in what was returned and they certainly don't respect the before
parameter. I even tried lowering the limit to make sure I wasn't trying to return more than I possessed. The problem persists.
如何正确执行Trello板的所有操作?
How can I correctly get all actions for a Trello board?
推荐答案
操作按相反的时间顺序排列(从最新到最旧),因此要翻阅板上的操作,可以使用类似以下内容的东西:
Actions are in reverse chronological order (newest-to-oldest), so to page through the actions on a board, you would use something like:
curl "https://api.trello.com/1/boards/${BOARD_ID}/actions/?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}&limit=1000"
然后,从上述返回的数组的最后一个元素中,选择date
或id
并将其作为下一个调用中的before
参数传递,例如:
then, from the last element of the array returned by the the above, select the date
or id
and pass that as the before
parameter in the next call, e.g.:
curl "https://api.trello.com/1/boards/${BOARD_ID}/actions/?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}&limit=1000&before=${DATE_OR_ID_OF_LAST_ACTION}"
并重复,将上一个动作的id
或date
作为后续的before
参数传入.
and repeat, passing in either the id
or date
of the last action as the subsequent before
parameter.
- Paging
- Board Actions
- Actions Nested Resource
这篇关于如何使用Trello的Rest API获得董事会的所有行动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!