* Fix error message in updateNoteFields method * Fix error handling in cardsInfo, notesInfo methods * Add more tests for updateNoteFields, notesInfo * Fix error handling in several methods Also fixed obvious bugs in replaceTags and replaceTagsInAllNotes methods. * Add more tests for cards methods * Add more tests for notes methods * Update documentation on cards methods
7.8 KiB
Card Actions
-
getEaseFactors
Returns an array with the ease factor for each of the given cards (in the same order).
Sample request:
{ "action": "getEaseFactors", "version": 6, "params": { "cards": [1483959291685, 1483959293217] } }
Sample result:
{ "result": [4100, 3900], "error": null }
-
setEaseFactors
Sets ease factor of cards by card ID; returns
true
if successful (all cards existed) orfalse
otherwise.Sample request:
{ "action": "setEaseFactors", "version": 6, "params": { "cards": [1483959291685, 1483959293217], "easeFactors": [4100, 3900] } }
Sample result:
{ "result": [true, true], "error": null }
-
suspend
Suspend cards by card ID; returns
true
if successful (at least one card wasn't already suspended) orfalse
otherwise.Sample request:
{ "action": "suspend", "version": 6, "params": { "cards": [1483959291685, 1483959293217] } }
Sample result:
{ "result": true, "error": null }
-
unsuspend
Unsuspend cards by card ID; returns
true
if successful (at least one card was previously suspended) orfalse
otherwise.Sample request:
{ "action": "unsuspend", "version": 6, "params": { "cards": [1483959291685, 1483959293217] } }
Sample result:
{ "result": true, "error": null }
-
suspended
Check if card is suspended by its ID. Returns
true
if suspended,false
otherwise.Sample request:
{ "action": "suspended", "version": 6, "params": { "card": 1483959293217 } }
Sample result:
{ "result": true, "error": null }
-
areSuspended
Returns an array indicating whether each of the given cards is suspended (in the same order). If card doesn't exist returns
null
.Sample request:
{ "action": "areSuspended", "version": 6, "params": { "cards": [1483959291685, 1483959293217, 1234567891234] } }
Sample result:
{ "result": [false, true, null], "error": null }
-
areDue
Returns an array indicating whether each of the given cards is due (in the same order). Note: cards in the learning queue with a large interval (over 20 minutes) are treated as not due until the time of their interval has passed, to match the way Anki treats them when reviewing.
Sample request:
{ "action": "areDue", "version": 6, "params": { "cards": [1483959291685, 1483959293217] } }
Sample result:
{ "result": [false, true], "error": null }
-
getIntervals
Returns an array of the most recent intervals for each given card ID, or a 2-dimensional array of all the intervals for each given card ID when
complete
istrue
. Negative intervals are in seconds and positive intervals in days.Sample request 1:
{ "action": "getIntervals", "version": 6, "params": { "cards": [1502298033753, 1502298036657] } }
Sample result 1:
{ "result": [-14400, 3], "error": null }
Sample request 2:
{ "action": "getIntervals", "version": 6, "params": { "cards": [1502298033753, 1502298036657], "complete": true } }
Sample result 2:
{ "result": [ [-120, -180, -240, -300, -360, -14400], [-120, -180, -240, -300, -360, -14400, 1, 3] ], "error": null }
-
findCards
Returns an array of card IDs for a given query. Functionally identical to
guiBrowse
but doesn't use the GUI for better performance.Sample request:
{ "action": "findCards", "version": 6, "params": { "query": "deck:current" } }
Sample result:
{ "result": [1494723142483, 1494703460437, 1494703479525], "error": null }
-
cardsToNotes
Returns an unordered array of note IDs for the given card IDs. For cards with the same note, the ID is only given once in the array.
Sample request:
{ "action": "cardsToNotes", "version": 6, "params": { "cards": [1502098034045, 1502098034048, 1502298033753] } }
Sample result:
{ "result": [1502098029797, 1502298025183], "error": null }
-
cardsInfo
Returns a list of objects containing for each card ID the card fields, front and back sides including CSS, note type, the note that the card belongs to, and deck name, as well as ease and interval.
Sample request:
{ "action": "cardsInfo", "version": 6, "params": { "cards": [1498938915662, 1502098034048] } }
Sample result:
{ "result": [ { "answer": "back content", "question": "front content", "deckName": "Default", "modelName": "Basic", "fieldOrder": 1, "fields": { "Front": {"value": "front content", "order": 0}, "Back": {"value": "back content", "order": 1} }, "css":"p {font-family:Arial;}", "cardId": 1498938915662, "interval": 16, "note":1502298033753, "ord": 1, "type": 0, "queue": 0, "due": 1, "reps": 1, "lapses": 0, "left": 6 }, { "answer": "back content", "question": "front content", "deckName": "Default", "modelName": "Basic", "fieldOrder": 0, "fields": { "Front": {"value": "front content", "order": 0}, "Back": {"value": "back content", "order": 1} }, "css":"p {font-family:Arial;}", "cardId": 1502098034048, "interval": 23, "note":1502298033753, "ord": 1, "type": 0, "queue": 0, "due": 1, "reps": 1, "lapses": 0, "left": 6 } ], "error": null }
-
forgetCards
Forget cards, making the cards new again.
Sample request:
{ "action": "forgetCards", "version": 6, "params": { "cards": [1498938915662, 1502098034048] } }
Sample result:
{ "result": null, "error": null }
-
relearnCards
Make cards be "relearning".
Sample request:
{ "action": "relearnCards", "version": 6, "params": { "cards": [1498938915662, 1502098034048] } }
Sample result:
{ "result": null, "error": null }