Skip to content

Latest commit

 

History

History
120 lines (92 loc) · 4.49 KB

api.md

File metadata and controls

120 lines (92 loc) · 4.49 KB

Actions

All actions here work exactly the same as Anki-Connect unless specified otherwise.

All calls support the version <= 4 and > 4 format. Versions <= 4 returns the plain result on success (with no JSON object wrapping said result). However, versions > 4 returns a JSON of the following format on success:

{
    "result": (result),
    "error": null
}

On error, all versions will send the following:

{
    "result": null,
    "error": (error)
}

Do not expect the error message to be the exact same as the PC Anki-Connect error messages.


Deck Actions

deckNames

deckNamesAndIds


Model Actions

modelNames

modelNamesAndIds

modelFieldNames


Note Actions

findNotes

  • See: Anki-Connect findNotes
  • Attempting to escape a query with spaces using quotes will not work, unless AnkiDroid is using the new (Rust) backend. For example, the following query will not work: "Note:My Mining Note"
  • Expect this to take longer to run compared to the PC version of Anki-Connect.
  • Used by Yomichan

guiBrowse

canAddNotes

  • See: Anki-Connect canAddNotes
  • Internally, this behaves entirely different from Anki-Connect. Anki-Connect literally attempts to add a note (without saving the collection) in order to determine whether the note can be added or not. AnkiConnect Android instead queries the collection with the first field, and sees if any other cards exist. For example, if your first field was Word, canAddNotes determines whether a note can be added or not by seeing if the query Word:(WORD FIELD CONTENTS) finds any matches. Finding any match will return false, and no matches will return true.
  • Because this internally queries the database, this action suffers from the same problems as findNotes. To guarantee the correctness of the query, you must use the new backend.
  • If all notes have the same model, then the call is optimized as we can call an internal Ankidroid API function on the entire set of data.
  • Used by Yomichan

canAddNotesWithErrorDetail

  • See: Anki-Connect `canAddNotesWithErrorDetail
  • Currently, if a card fails canAddNotes, the error message will always say it's due to it being a duplicate, even if there was a different reason for the failure (For example, in Anki-Connect a card could fail the canAddNotes check if the first field was empty).
  • Used by Yomitan

notesInfo

addNote

  • See: Anki-Connect addNote
  • Used by Yomichan
  • Anki-Connect desktop allows using various formats for the media file, but this api currently only supports using the url and data field. Does not support skipHash for the url field. All of picture, audio and video are supported.

updateNoteFields


Media Actions

storeMediaFile

  • See: Anki-Connect storeMediaFile
  • Filenames will get a random number appended to the end of them, i.e. file.png becomes file_123456789.png
  • Used by Yomichan

Miscellaneous Actions

multi