Application API (v1): Search Cards
If your edition of LeanKit supports searching for Cards, you can use the following API endpoints to search for Cards on a specific Board, or across all Boards.
Search Cards on a Specific Board
Request URL (POST)
https://{accountname}.leankit.com/kanban/api/board/{boardId}/searchcards
{ "searchOptions":{ "SearchTerm":"[text to search for]", "SearchInBoard":true, ... [More search options, see following...] } }
Search Cards Across All Boards
Request URL (POST)
https://{accountname}.leankit.com/kanban/api/v1/card/search
{ "searchOptions":{ "SearchTerm":"[text to search for]", ... [More search options, see following...] } }
Search Options
SearchTerm | Text to find in cards. Possible to search multiple terms at once, separated by spaces. Default is "". |
SearchInBacklog | [true | false] Include cards in the Backlog in search. Default value is false. |
SearchInBoard | [true | false] Include cards on the board in search. Default value is false. |
SearchInRecentArchive | [true | false] Include cards in the recent archive (moved to archive less than 14 days ago) in the search. Default value is false. |
SearchInOldArchive | [true | false] Include cards in the old archive (moved to archive more than 14 days ago) in the search. Default value is false. |
IncludeComments | [true | false] Include comments in search. Default value is false. |
IncludeTags | [true | false] Include tags in search. Default value is false. |
IncludeExternalId | [true | false] Include external ID field in search. Default value is false. |
AssignedUserIds | Array of user IDs. Example: [123, 222, 5688]. Default is []. |
AddedAfter | Date as string. Default is null. |
AddedBefore | Date as string. Default is null. |
Page | Page of results to retrieve. Default is 1 (first page). |
MaxResults | Maximum number of cards to return, per page. Default value is 20. Currently, the maximum number of cards returned is limited to 20. Any value over 20 will be reduced to 20. |
OrderBy | Return cards sorted by field. Available values are: "CreatedOn" and "Title". Default value is "CreatedOn". |
SortOrder | [0 | 1] Sort results in ascending (0) or descending (1) order. Default is 0. |
Sample Request
In the following sample, the request searches for archived cards older than 14 days, added between the dates of 10/25/2013 and 11/26/2013, and limits the results to the first 20 cards. The AddedAfter
and AddedBefore
dates must be in the same date format configured on the account making the API request (i.e. Month/Day/Year, Day/Month/Year, or Year/Month/Day).
https://myaccount.leankit.com/kanban/api/board/101000/searchcards
Sample Request Body
{ "searchOptions":{ "SearchTerm":"", "SearchInOldArchive":true, "AddedAfter":"10/25/2013", "AddedBefore":"11/26/2013", "Page":1, "MaxResults":20 } }
Response
{ "ReplyData":[ { "Results":[ { "SystemType":"Card", "Id":101022, "BoardId":101000, "BoardTitle":"Sample Board", "LaneId":101012, "LaneTitle":"Archive", "Title":"Sample Archived Card 1", "Description":"", "Type":{ "Id":101015 }, "TypeId":101015, "Priority":2, "PriorityText":"High", "TypeName":"Task", "TypeIconPath":"../../Content/Images/Icons/Library/help.png", "TypeColorHex":"#f5f2bc", "Size":6, "Active":true, "Color":"#f5f2bc", "Icon":"", "Version":20, "AssignedUsers":[ { "Id":101215, "GravatarLink":"b787614609c337da57158f9ffb4f49a4?s=25", "SmallGravatarLink":"b787614609c337da57158f9ffb4f49a4?s=17", "EmailAddress":"testuser@test.com", "FullName":"Test User", "AssignedUserName":"Test User", "AssignedUserId":101215 } ], "IsBlocked":false, "BlockReason":null, "BlockStateChangeDate":null, "Index":18, "StartDate":null, "DueDate":null, "ExternalSystemName":"", "ExternalSystemUrl":"", "ExternalCardID":"", "ExternalCardIdPrefix":null, "Tags":null, "DrillThroughBoardId":null, "ParentCardId":null, "ParentBoardId":0, "HasDrillThroughBoard":false, "DrillThroughCompletionPercent":0, "DrillThroughProgressTotal":null, "DrillThroughProgressComplete":null, "DrillThroughProgressSizeComplete":null, "DrillThroughProgressSizeTotal":null, "ParentTaskboardId":null, "ClassOfServiceId":0, "ClassOfServiceTitle":null, "ClassOfServiceIconPath":null, "ClassOfServiceColorHex":null, "CountOfOldCards":0, "CardContexts":[ ], "CurrentTaskBoardId":null, "CurrentContext":null, "TaskBoardCompletionPercent":0, "TaskBoardCompletedCardCount":0, "TaskBoardCompletedCardSize":0, "TaskBoardTotalCards":0, "TaskBoardTotalSize":0, "LastMove":"10/28/2013 09:27:45 PM", "LastActivity":"10/28/2013 09:27:45 PM", "DateArchived":"10/28/2013", "CommentsCount":0, "LastComment":"", "AttachmentsCount":0, "LastAttachment":"", "CreateDate":"10/27/2013", "AssignedUserName":"Test User", "AssignedUserId":101215, "AssignedUserIds":[ 101215 ], "GravatarLink":"b787614609c337da57158f9ffb4f49a4?s=25", "SmallGravatarLink":"b787614609c337da57158f9ffb4f49a4?s=17", "IsOlderThanXDays":true }, /* Additional results ... */ ], "TotalResults":45, "Page":1, "MaxResults":20 } ], "ReplyCode":200, "ReplyText":"Card search was successful." }