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
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