Updating a schema event trigger
The easiest way to update a schema event trigger for a task is to configure one through the QMC and retrieve the configuration through the QRS API. This event trigger configuration can then be applied programmatically to an existing task.
To update a schema event trigger and associate it with 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, create a task that you will use to generate the required schema event configuration. Configure the schema event trigger for the task and note the event trigger name.
- Call the qrs/schemaevent API endpoint to retrieve the schema event entities for all tasks: GET qrs/schemaevent.
- In the response body of the API call, locate the schema event entity with the event trigger name that you entered in the QMC. Note the ID for this schema event entity.
- Call the qrs/schemaevent API endpoint with the schema event entity ID appended to the path to retrieve the detailed event configuration: GET qrs/schemaevent/{id}.
- Copy the entire content of the response body and paste it within schemaEvents:[] 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-23T18:05:55.301Z", "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 app xyz", "taskType": 0, "enabled": true, "taskSessionTimeout": 1440, "maxRetries": 4, "tags": [], "privileges": null, "impactSecurityAccess": false, "schemaPath": "ReloadTask" }, "schemaEvents":[{ "id": "41bf38be-db79-42f9-99b5-b7e06d0828c6", "createdDate": "2017-01-23T15:15:53.794Z", "modifiedDate": "2017-01-23T18:05:55.301Z", "modifiedByUserName": "INTERNAL\\sa_repository", "timeZone": "America/New_York", "daylightSavingTime": 0, "startDate": "2017-01-23T10:19:29.000", "expirationDate": "9999-01-01T00:00:00.000", "schemaFilterDescription": [ "* * - 1 1 * * *" ], "incrementDescription": "0 0 1 0", "incrementOption": 3, "operational": null, "name": "WeeklyEventTrigMon", "enabled": false, "eventType": 0, "reloadTask": { "id": "cf958691-4e4d-40ef-9510-48b39ef862d0", "operational": null, "name": "Reload task for app xyz", "taskType": 0, "enabled": true, "taskSessionTimeout": 1440, "maxRetries": 4, "privileges": null }, "userSyncTask": null, "externalProgramTask": null, "privileges": null, "impactSecurityAccess": false, "schemaPath": "SchemaEvent" }], "compositeEvents":[] }
- 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 configured schema event trigger.