Using the REST select API?

In order to include search in the Rust command line client, I was looking at the /cards/get/select endpoint. The search field seems to work well enough, but as mentioned in another post, the results are different from the webapss that uses a websocket connection for search. It seems junked cards are included.

@connor In that other topic, you seemed to suggest REST-based search is unsupported, but I may be mistaken. If not, any way to exclude junked cards?

Search from the API is actually well-supported on that endpoint, you just can’t rely on it to provide consistent results with the web frontend. The API search is much more strict than the fuzzy search provided by the frontend.

In order to filter out junked cards, you can use the include_membership_statuses parameter, like so:

{
  "search": "hello",
  "include_membership_statuses": [1, 2]
}

where possible statuses to include are:
-2: Junked
-1: [only used internally]
0: Pending cards (inbox)
1: Unkept cards
2: Kept cards

Great, that worked! Thanks, @connor.

1 Like