Updating a composite event trigger
To update a composite event trigger for a task, retrieve the task and composite event entities of the task and then update the composite event entity.
To update a composite event trigger for a task:
- Enter the following into a text editor:
{ "task":{}, "schemaEvents": [], "compositeEvents":[] }
- Call the qrs/reloadtask/{id} API endpoint to retrieve the task entity for the task you want to update.
- Copy the entire content of the response body (without the opening and closing braces) and paste it within task:{}.
- In the QMC, note the name of the composite event trigger for the task.
- Call the qrs/compositeevent API endpoint to retrieve the composite event entities for all tasks: GET qrs/compositeevent.
- In the response body of the API call, locate the composite event entity with the event trigger name that you noted in the QMC. Note the ID for this composite event entity.
- Call the qrs/compositeevent API endpoint with the composite event entity ID appended to the path to retrieve the detailed event configuration: GET qrs/compositeevent/{id}.
- Copy the entire content of the response body and paste it within compositeEvents:[] in the text editor.
The complete JSON request body should look similar to the following:
{ "task":{ "id": "cf958691-4e4d-40ef-9510-48b39ef862d0", "createdDate": "2017-01-23T15:15:53.794Z", "modifiedDate": "2017-01-24T22:44:21.494Z", "modifiedByUserName": "INTERNAL\\sa_repository", "customProperties": [], "app": { "id": "bda74c3e-c7e6-4154-845a-139ad7c07390", "name": "License Monitor", "appId": "", "publishTime": "2016-12-30T17:52:13.609Z", "published": true, "stream": { "id": "a70ca8a5-1d59-4cc9-b5fa-6e207978dcaf", "name": "Monitoring apps", "privileges": null }, "savedInProductVersion": "4.16.0", "migrationHash": "82b8362010f6f32f12217392e08c75194db0d4fc", "availabilityStatus": 0, "privileges": null }, "isManuallyTriggered": false, "operational": null, "name": "Reload task for License Monitor app", "taskType": 0, "enabled": true, "taskSessionTimeout": 1440, "maxRetries": 4, "tags": [], "privileges": null, "impactSecurityAccess": false, "schemaPath": "ReloadTask" }, "schemaEvents": [], "compositeEvents":[{ "id": "0d20532d-3097-497f-93e7-e99958c666fe", "createdDate": "2017-01-23T18:05:55.301Z", "modifiedDate": "2017-01-24T22:49:11.002Z", "modifiedByUserName": "INTERNAL\\sa_repository", "timeConstraint": { "id": "0d20532d-3097-497f-93e7-e99958c666fe", "createdDate": "2017-01-23T18:05:55.301Z", "modifiedDate": "2017-01-24T22:49:11.002Z", "modifiedByUserName": "INTERNAL\\sa_repository", "days": 0, "hours": 0, "minutes": 360, "seconds": 0, "impactSecurityAccess": false, "schemaPath": "CompositeEvent.TimeConstraint" }, "compositeRules": [{ "id": "b5b01e3b-f4b4-4791-b88d-d5713e40e1f0", "createdDate": "2017-01-23T18:05:55.301Z", "modifiedDate": "2017-01-24T22:49:11.002Z", "modifiedByUserName": "INTERNAL\\sa_repository", "ruleState": 1, "reloadTask": { "id": "b52e92e3-7bd5-4cfe-bc37-0017b0bef39b", "operational": { "id": "05e12ad2-2586-4965-a896-0899387ffbb5", "lastExecutionResult": { "id": "dcfb61a7-c003-49a4-a2bf-f9669af2b592", "executingNodeName": "", "status": 0, "startTime": "1753-01-01T00:00:00.000Z", "stopTime": "1753-01-01T00:00:00.000Z", "duration": 0, "fileReferenceID": "00000000-0000-0000-0000-000000000000", "scriptLogAvailable": false, "details": [], "privileges": null }, "nextExecution": "2017-01-26T16:15:07.000Z", "privileges": null }, "name": "Reload task for app xyz", "taskType": 0, "enabled": true, "taskSessionTimeout": 1440, "maxRetries": 7, "privileges": null }, "userSyncTask": null, "externalProgramTask": null, "operational": { "id": "96707aee-3360-4194-884a-6130988fde29", "timeStamp": "1753-01-01T00:00:00.000Z", "currentState": 0, "privileges": null }, "impactSecurityAccess": false, "schemaPath": "CompositeEvent.Rule" } ], "operational": { "id": "481406bc-ceb5-4e6e-a81c-c66b35b4fd52", "timesTriggered": 0, "privileges": null }, "name": "taskEventTrig99", "enabled": true, "eventType": 1, "reloadTask": { "id": "cf958691-4e4d-40ef-9510-48b39ef862d0", "operational": null, "name": "Reload task for License Monitor app", "taskType": 0, "enabled": true, "taskSessionTimeout": 1440, "maxRetries": 4, "privileges": null }, "userSyncTask": null, "externalProgramTask": null, "privileges": null, "impactSecurityAccess": false, "schemaPath": "CompositeEvent" }] }
- To update the reload task with a new task event trigger, substitute the reloadTask ID and reloadTask name in compositeRules:[] with the new task ID and name that you want to serve as the task event trigger. If you want to trigger the reload task when the task that is specified in the task event trigger fails, set ruleState to 2; a value of 1 means that the reload task will be triggered when the task that is specified in the task event trigger succeeds.
- Copy the entire content from the text editor and paste it into the request body of the /qrs/reloadtask/update API call to update the reload task with the new composite event trigger.