triggerprototype.update

Description

object triggerprototype.update(object/array **triggerPrototypes**)

This method allows to update existing trigger prototypes.

Parameters

(object/array) Trigger prototype properties to be updated.

The triggerid property must be defined for each trigger prototype, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

Additionally to the standard trigger prototype properties the method accepts the following parameters.

ParameterTypeDescription
dependenciesarrayTriggers and trigger prototypes that the trigger prototype is dependent on.

The triggers must have the triggerid property defined.
tagsarrayTrigger prototype tags.

The trigger expression has to be given in its expanded form and must contain at least one item prototype.

Return values

(object) Returns an object containing the IDs of the updated trigger prototypes under the triggerids property.

Examples

Enabling a trigger prototype

Enable a trigger prototype, that is, set its status to 0.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "triggerprototype.update",
  4. "params": {
  5. "triggerid": "13938",
  6. "status": 0
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "triggerids": [
  5. "13938"
  6. ]
  7. },
  8. "id": 1
  9. }

Replacing trigger prototype tags

Replace tags for one trigger prototype.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "triggerprototype.update",
  4. "params": {
  5. "triggerid": "17373",
  6. "tags": [
  7. {
  8. "tag": "volume",
  9. "value": "{#FSNAME}"
  10. },
  11. {
  12. "tag": "type",
  13. "value": "{#FSTYPE}"
  14. }
  15. ]
  16. },
  17. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  18. "id": 1
  19. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "triggerids": [
  5. "17373"
  6. ]
  7. },
  8. "id": 1
  9. }

Source

CTriggerPrototype::update() in ui/include/classes/api/services/CTriggerPrototype.php.