Kerio Blog

Antivirus SDK: How to configure plugin options through Administration API

When creating an antivirus plugin you would probably need some config option to setup as described in SDK documentation.

Take a look on sample implementation. There is a list of options.

avir_plugin_config plugin_config[] = {
{"Option 1", "0"},
{"Option 2", "a string"},
{"", ""} // mandatory terminating pair of two empty strings
};

But how to change configuration of the plugin without need to edit config files directly? That's what is Administration API for Kerio Connect designed for.

There is a method Content.setAntivirusSetting (reference documentation) where you can send all your config options with its values.

It is defined also as a list of options with the following data structure.

See sample JSON request for my plugin configuration:

{
"jsonrpc": "2.0",
"id": 1,
"method": "Content.setAntivirusSetting",
"params": {
"setting": {
"useExternal": true,
"selectedId": "avir_myplugin",
"plugins": [
{
"id": "avir_myplugin",
"options": [
{
"name": "Option 1",
"content": "1000"
},
{
"name": "Option 2",
"content": "This is new value"
}
]
}
]
}
}
}

Options can be set individually or all at once.

If you need to read the configuration, use the Content.getAntivirusSetting method.

For more information about Antivirus SDK see our Developer Zone.

mosladil's picture
About the Author

Senior Developer @mosladil