How do I find a deck with AnkiConnect?

This is a very simple question but somehow I can’t find an answer to it. I’m trying to get all the cards of a deck using AnkiConnect, but I think my query is incorrect.

This is what I’m using

    data = {
        "action": "findNotes",
        "version": 6,
        "params": {
        "query": "deck:1 - Main"
        }
    }

Which, for some reason, returns one card. "query": "*" returns all the cards, so it’s not a problem with the code itself.

I copy pasted this search query from the Anki browser: “deck:1 - Main::0 - Tasks::0 - Quire”, which returns 3 cards (the expected output), but it returns 0 cards when I use the same query on AnkiConnect. Does anyone know how to solve this? This is how I’m trying to query:

    data = {
        "action": "findNotes",
        "version": 6,
        "params": {
        "query": "deck:1 - Main::0 - Tasks::0 - Quire"
        }

You’re missing quotes.

https://docs.ankiweb.net/searching.html#tags-decks-cards-and-notes

1 Like