3.3 KiB
Miscellaneous Actions
-
version
Gets the version of the API exposed by this plugin. Currently versions
1
through6
are defined.This should be the first call you make to make sure that your application and AnkiConnect are able to communicate properly with each other. New versions of AnkiConnect are backwards compatible; as long as you are using actions which are available in the reported AnkiConnect version or earlier, everything should work fine.
Sample request:
{ "action": "version", "version": 6 }
Sample result:
{ "result": 6, "error": null }
-
sync
Synchronizes the local Anki collections with AnkiWeb.
Sample request:
{ "action": "sync", "version": 6 }
Sample result:
{ "result": null, "error": null }
-
getProfiles
Retrieve the list of profiles.
Sample request:
{ "action": "getProfiles", "version": 6 }
Sample result:
{ "result": ["User 1"], "error": null }
-
loadProfile
Selects the profile specified in request.
Sample request:
{ "action": "loadProfile", "params": { "name": "user1" }, "version": 6 }
Sample result:
{ "result": true, "error": null }
-
multi
Performs multiple actions in one request, returning an array with the response of each action (in the given order).
Sample request:
{ "action": "multi", "version": 6, "params": { "actions": [ {"action": "deckNames"}, { "action": "browse", "params": {"query": "deck:current"} } ] } }
Sample result:
{ "result": [ {"result": "Default", "error": null}, {"result": [1494723142483, 1494703460437, 1494703479525], "error": null} ], "error": null }
-
exportPackage
Exports a given deck in
.apkg
format. Returnstrue
if successful orfalse
otherwise. The optional propertyincludeSched
(default isfalse
) can be specified to include the cards' scheduling data.Sample request:
{ "action": "exportPackage", "version": 6, "params": { "deck": "Default", "path": "/data/Deck.apkg", "includeSched": true } }
Sample result:
{ "result": true, "error": null }
-
importPackage
Imports a file in
.apkg
format into the collection. Returnstrue
if successful orfalse
otherwise. Note that the file path is relative to Anki's collection.media folder, not to the client.Sample request:
{ "action": "importPackage", "version": 6, "params": { "path": "/data/Deck.apkg" } }
Sample result:
{ "result": true, "error": null }