Api to simplify addon writing

I am writing a addon to generate new cards from BIng Dictionary but I am not familiar with anki. I want a simple api to connect my code and anki so I find ankiconnect.
But the ankiconnect addon is in self-serve mode and has some bugs.

I am thinking if it is possible to have some one or a group to create a similar api to help others to create their addons or even better add the api to anki itself.

Addons is a great way to make anki much more powerful. With the user group growing larger, I think making more addons is the best and maybe the only way to fit more people’s needs. Maybe addons can be as important to anki as extensions to Vscode and a easy to use and rubust api can really help.

I can’t help you with an API but I can tell you about my adventures with add ons.

I wanted an add on that didn’t exist to do some batch changes.

There were already two add ons that were close to what I wanted Note_id and Batch_id. Together with my new add on I got my files fixed.

Interestingly, I probably spent many more hours making the add on than I would have spent had I changed all my decks manually. But now if I ever have to do it again, I can do it relatively quickly…

I now also partially know QT5 (spit, stamp and burn, I don’t like QT5 ! ! ! )

I created a new add on by copying an existing add on in the anki directory to a new directory

C:\Users\mnmmc\AppData\Roaming\Anki2\addons21\somenumber to
C:\Users\mnmmc\AppData\Roaming\Anki2\addons21\myspiffynewaddon

then change the meta.json file and you now have a new add on

then delete the original add on so you don’t have conflicts

restart Anki make sure it still works

I changed the dialogs and menu structure and got some bits from other add ons

I must admit I had a great deal of difficulty getting my dialog to work correctly but once you have one bit working and you understand what you did to make it work you just have to add more bits

Custom background gave me most of dialog bits and showed me how to do lambda functions to get stuff from my dialog to the program

Note_id can show you how to populate fields when you create a new card

Batch_edit can also show you how to change a bunch of cards in a deck

If you bring up the list of adds on and search for import, there are a bunch of add ons that import stuff so no end of code to look at there for importing your data.

I asked for some help to create the dialog and the following was suggested

A Qt tutorial may help: PyQt/Tutorials - Python Wiki

1 Like

Thank you for sharing your experience. It is a good idea to check some similar addons. And I don’t like QT5 too! ! !

1 Like

Anki already does kind of have an api.
https://addon-docs.ankiweb.net/hooks-and-filters.html