FooSoft / anki-connect

Anki plugin to expose a remote API for creating flash cards.
https://foosoft.net/projects/anki-connect/
Other
1.92k stars 218 forks source link

modelTemplateRename always responds with "unsupported action" #408

Open jojo259 opened 10 months ago

jojo259 commented 10 months ago

Seems to also apply to modelTemplateAdd and modelTemplateRename (potentially others too).

import requests

response = requests.post('http://localhost:8765', json = {
    'action': 'modelTemplateRename',
    'version': 6,
    'params': {
        'modelName': 'Basic',
        'oldTemplateName': 'Card 1',
        'newTemplateName': 'Card 1 renamed'
    }
})

print(response.text)
curl -X POST -H "Content-Type: application/json" -d "{\"action\": \"modelTemplateRename\", \"version\": 6, \"params\": {\"modelName\": \"Basic\", \"oldTemplateName\": \"Card 1\", \"newTemplateName\": \"Card 1 renamed\"}}" http://localhost:8765

Always results in {"result": null, "error": "unsupported action"} no matter which versions, model names, or template names I use and the same applies to the other two actions.

Line of code with that string: https://github.com/FooSoft/anki-connect/blob/master/plugin/__init__.py#L128