KSC Open API
Kaspersky Security Center API description
wstring Tasks::AddTask ( params  pData)

Create new task.

Creates new task.

Parameters:
pData(params) task settings, see Task settings format
Returns:
(wstring) task id in digital representation, like "1" or "45" and etc.

See also Python code with use of KlAkOAPI Python package below:

            server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False)
            oTasks = KlAkOAPI.Tasks.KlAkTasks(server)
            nRootGroupId = KlAkOAPI.HostGroup.KlAkHostGroup(server).GroupIdGroups().RetVal()
            # compose params that keeps settings of notification about changing task state
            pNotifDefault = KlAkOAPI.Params.KlAkParams({"KLEVP_ND_DAYS_TO_STORE_EVENT": 1, "KLEVP_ND_EVETN_TYPE": "KLPRCI_TaskState", "KLEVP_ND_STORE_AT_CLIENT_LOG": False, "KLEVP_ND_STORE_AT_CLIENT_PRES": False, "KLEVP_ND_STORE_AT_SERVER_LOG": False})
            pInfNotif_TaskRunning = KlAkOAPI.Params.KlAkParams(pNotifDefault)
            pInfNotif_TaskRunning.AddParams("KLEVP_ND_BODY_FILTER", {"KLPRCI_newState": 1})
            pInfNotif_TaskSuspended = KlAkOAPI.Params.KlAkParams(pNotifDefault)
            pInfNotif_TaskSuspended.AddParams("KLEVP_ND_BODY_FILTER", {"KLPRCI_newState": 2})
            pInfNotif_TaskCompleted = KlAkOAPI.Params.KlAkParams(pNotifDefault)
            pInfNotif_TaskCompleted.AddParams("KLEVP_ND_BODY_FILTER", {"KLPRCI_newState": 4})
            pInfNotif = KlAkOAPI.Params.KlAkParams(pNotifDefault)
            pInfNotif.AddString("KLEVP_ND_EVETN_TYPE", "KLEVP_GroupTaskSyncState")
            pNotif = KlAkOAPI.Params.KlAkParams({"ERR": [pNotifDefault], "INF": [pInfNotif, pInfNotif_TaskRunning, pInfNotif_TaskSuspended, pInfNotif_TaskCompleted], "WRN": [pNotifDefault] })
            # compose params that contains info about task to be created: task type 'show message', schedule type 'start manually', display name 'kloapiTask', acts in group 'Managed devices', notify about state changes
            oTaskParams = KlAkOAPI.Params.KlAkParams({"TASKID_COMPONENT_NAME": "86", "TASKID_PRODUCT_NAME": "1103", "TASKID_VERSION": "1.0.0.0", "TASK_NAME": "KLNAG_TASK_SHOW_MSG"})
            oTaskParams.AddParams("TASK_ADDITIONAL_PARAMS", {"KLNAG_MSG_TEXT": "Test message"})
            oTaskParams.AddInt("TASKSCH_TYPE", 0)
            oTaskParams.AddParams("TASK_INFO_PARAMS", {"DisplayName": "kloapiTask", "PRTS_TASK_GROUPID": nRootGroupId, "klprts-TaskScheduleSubtype": 256, "KLPRSS_EVPNotifications": pNotif})
            # create task
            strTaskId = oTasks.AddTask(oTaskParams).RetVal()
            print('Created task id is:' , strTaskId)
            
See also:
Sample. Creating and running task.