Fetching cards changed since ts

Hi!

I’m trying to fetch cards changed since the last time queried, only querying for a few per request, using the Trello rest api.
For this I need the api endpoint to support ‘modified since’ filter and order by edit time (asc), and preferably also explicit limit on results.

I saw 3 options for that:

  1. search endpoint: doesn’t seem to support ‘since ts’ filtering.
  2. Nested Cards as Query Params: supports cards_modifiedSince, but not ordering or limiting.
  3. Nested Cards as URL Params: doesn’t support any of these (only filtering by created ts).

Am I missing anything?
Does anyone have an idea on a good way to implement it?

I saw this reference in another message, which seems very relevant but not sure how to use it for my use case as I couldn’t find any documentation regarding order or limit (I only want to handle small batch at a time).

Thanks!

:wave: Using a public board as an example, I was able to get the cards modified since 2019-08-29T15:58:36.000Z. Here is the request:

https://trello.com/1/boards/LmBFwbBK/cards?modifiedSince=5d67f62c6780b93d9a1fb31c&filter=open&limit=2

If you remove limit=2 you’ll see that we get back more than 2, so limiting appears to be working. I believe you can use the dateLastActivity field of the most recently modified card as the new value for modifiedSince.

Alternatively, you could use the actions resource as a ledger for keeping track of things that have happened on the board:

https://trello.com/1/boards/LmBFwbBK/actions?filter=updateCard

Do keep in mind that the IDs of Trello objects are Mongo IDs and have the time of creation for the object encoded in them: https://steveridout.github.io/mongo-object-time/.

Thanks @bcook!

My problem with using both limit and modifiedSince for pagination was that it requires the result cards to be ordered by modification time.
For example: let’s say a board has 3 cards: A modified at time x, B modified at x+1 and C modified at x+2. If I’m limiting by 2 and the items are returned at some other arbitrary order I might get A and C on the first call and then never get item B (querying for items modified after time x+2).
I found this regarding the order cards are returned in but guessing in that context “chronologically” means created time (referring there to before and since arguments)? I think for my case it would also need to be ascending time.

Am I missing anything?

As mentioned, search does seem to support ordering but not a similar modifiedSince parameter that supports ts- am I missing anything there?

This might be a good workaround… I’ll look more into it although I’m not sure if it suits my use case exactly (I’m looking for modified cards the user is member of so I would need the actions grouped and in the context of member’s cards).

Thanks again :slight_smile:!