Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,457,736
Community Members
 
Community Events
176
Community Groups

HELP. API Call for Search using Query parameter

Edited

Can someone give me an example on how to write an API call for searching cards edited recently.  Here is my implementation.  What is wrong with this?

https://api.trello.com/1/search?query={5ee0fc79f2168d8f019b76ea}

It would be nice if you guys can provide some examples on your website.  Thank you.  Here is the link.

https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get

There is an example towards the bottom of the page, but I am not following it.  Only 1 parameter ("query") is required.  I also know that "edited:day" is needed to find the cards that were edited recently.

How do I assemble the complete API call with the filter "edited:day"? I have been testing my API calls in Postman but nothing seems to work.  Thank you.

1 answer

1 accepted

0 votes
Answer accepted
Lara Atlassian Team Mar 21, 2022

Hi there,

Thanks for reaching out!

Firstly, you'll need to authorize with Trello's API at https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/ so you can have a key and token which is used to authorize your access to Trello's API.

To specifically call a search query that returns all cards that have been edited in the past day, it would be the following query:

https://api.trello.com/1/search?query=test%20edited%3Aday%20&modelTypes=cards&key={key}&token={token}

Since the "edited:day" filter is a modifier to the query, it must be updated to the query string as such (%20 is a space and %3A is the colon). The key and token would be the values from the authorization process above.

For example:

https://api.trello.com/1/search?query=test%20edited%3Aday%20&modelTypes=cards&key=qwertyrandomkeyqwerty&token=1234randomtoken1234

Please let us know if you have any other questions, and we'll be happy to help.

All the best,

Lara
The Trello Team

Hello Lara,

Thank you so much.  One more question.  If I want to search by List, where should I put it in that link.

In my python code, I loop through each board.  On each board, I loop though each list.  Once I am inside a list, I want to retrieve the cards that were edited in the last X number of days.  The documentation says to search like this:

list:name

However, I don't understand where to insert it in the link.  Here is the link for this information.

https://help.trello.com/article/808-searching-for-cards-all-boards

Thank you :=)

Hi there,

Similarly to the first query, the list:name filter is a modifier to the query, so it must be updated to the query string as such (%20 is a space and %3A is the colon). In the example below, {name} is the list name.

https://api.trello.com/1/search?query=test%20edited%3Aday%20list%3A{name}&modelTypes=cards&key={key}
&token={token}

Our team is aware that our modifiers are not well constructed and are working towards improving the search space overall!

Please let us know if you have any other questions, and we'll be happy to help.

All the best,

Lara
The Trello Team

Thank you, Lara!  I appreciate your time and effort in answering my questions.

Like Lara likes this

Hello Lara,

In this call, I noticed:

query=test

What is test?

I am only looking for the cards Updated/Edited AND Created in the last X number of days.  X is the number of days depending on my criterion.   

Thank you. 

https://api.trello.com/1/search?query=test%20edited%3Aday%20list%3A{name}&modelTypes=cards&key={key}
&token={token}

 

Hi there,

The example "test" you're seeing is the search query. If you don't need a search query, you can just use edited:day and created:day to find cards that were edited in the past 24 hours, and cards created in the past 24 hours.

https://api.trello.com/1/search?query=edited%3Aday%20created%3Aday&modelTypes=cards&key={key}&token={token}

Hope that helps!

All the best,

Lara
The Trello Team

Hi Laura,

Thank you so much.  I really appreciate your help.  I have one more question.  If I want to narrow my search down to a board and a list on that board, how can I do that.

Example: 

Name of board: a_board

Name of list: a_list

Simply giving the name of the list is not helpful because there are many boards with same list name.  That's why I would like to narrow it down by a board and a list.  If we cannot include both modifiers, then I would like to use the List ID as modifier, because that would unique.

Thank you!

Hi there,

If you'd like to perform the search for a specific board(s), you'll need to include idBoard in your request, and enter the board ID.

For example:

https://api.trello.com/1/search?query=edited%3Aday%20&modelTypes=cards&idBoard={boardid}&key={apikey}&token={apitoken}

Hope that helps!

All the best,

Lara
The Trello Team

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events