-
Notifications
You must be signed in to change notification settings - Fork 94
RESTful API Documentation
Unfortunately, there still isn't complete documentation on using the RESTful API. However, here is a super quick overview with information about how to gleen more information.
Please edit this page and help improve it!
All the code for the API and be found in this file:
https://github.com/dsnopek/anki-sync-server/blob/master/AnkiServer/apps/rest_app.py
All of the endpoints take HTTP POST requests and accept/return JSON (except for the top-level URL, which is a GET request and returns text with version information). So, the API is actually not quite RESTful, it's more like a super simple HTTP RPC.
There is one magic URL, /list_collections which returns the names of all available collections. Every other URL will contain the collection name and is directly connected to a Handler class:
- /collection/[NAME]/[METHOD] -> CollectionHandler
- /collection/[NAME]/model/[MODEL_ID]/[METHOD] -> ModelHandler
- /collection/[NAME]/note/[NOTE_ID]/[METHOD] -> NoteHandler
- /collection/[NAME]/deck/[DECK_ID]/[METHOD] -> DeckHandler
- /collection/[NAME]/card/[CARD_ID]/[METHOD] -> CardHandler
Replace [NAME] with the collection name and [METHOD] with a paricular method on the Handler class that you want to call. So, for example, POSTing to this URL:
/collection/mine/latest_notes
... will call the CollectionHandler.latest_notes() method in the rest_app.py file I linked above.
TODO: document all the methods on the CollectionHandler
TODO: document all the methods on the ModelHandler
TODO: document all the methods on the NoteHandler
TODO: document all the methods on the DeckHandler
TODO: document all the methods on the CardHandler