[ZBXNEXT-3407] Zabbix API trigger.update allow array of triggerid not only one triggerid Created: 2016 Aug 26  Updated: 2017 May 31  Resolved: 2016 Dec 15

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Documentation (D)
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Major
Reporter: Adrian Tartareanu Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: API, massupdate, trigger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Currently trigger.update allows working with only one id at a time without being able to update an array of triggers.
https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/update

example:

{
    "jsonrpc":  "2.0",
    "method":  "trigger.update",
    "params":  {
                   "triggerid":  [
                                     "100100000048256",
                                     "100100000048257"
                                 ],
                   "status":  1
               },
    "id":  "2",
    "auth":  "266421fd8fcb977e971300b2bfbce6cc"
}

will return invalid parameters while

{
    "jsonrpc":  "2.0",
    "method":  "trigger.update",
    "params":  {
                   "triggerid":  "100100000048256",
                   "status":  1
               },
    "id":  "2",
    "auth":  "266421fd8fcb977e971300b2bfbce6cc"
}

works fine



 Comments   
Comment by Aleksandrs Saveljevs [ 2016 Aug 30 ]

As discussed with iivs, updating multiple triggers in a single API call is already possible like so (by replicating the parameters):

{
    "jsonrpc": "2.0",
    "method": "trigger.update",
    "params":
    [
        {
            "triggerid": "13772",
            "status":  1
        },
        {
            "triggerid": "13773",
            "status":  1
        },
        {
            "triggerid": "13774",
            "status":  1
        }
    ],
    "id": "2",
    "auth": "266421fd8fcb977e971300b2bfbce6cc"
}

For hosts and host groups, there are host.massupdate and hostgroup.massupdate methods, but there is a general trend to move away from them, so trigger.massupdate method is unlikely to be added.

Comment by Adrian Tartareanu [ 2016 Aug 31 ]

it works !
you may want to update the documentation accordingly, adding this example as well, as it's not very intuitive how to build the json when working with multiple ids.

thank you very much.

Comment by Aleksandrs Saveljevs [ 2016 Aug 31 ]

It seems to me like the documentation should be updated, too, because I did not find an example mentioning a similar usage either. The linked page https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/update says that parameters are either an object or an array, but gives no example as to what it means. The main API page at https://www.zabbix.com/documentation/3.2/manual/api says that "The item.create method as well as other create methods can also accept arrays of objects and create multiple items with one API call", but it only talks about create methods.

Comment by Ivo Kurzemnieks [ 2016 Nov 24 ]

(1) There are so many methods, that adding or replacing examples in all of them, would take very long time. Instead we added examples and information in the gerenal API page here:

Please, review.

sasha CLOSED

Generated at Sun Jul 06 01:31:33 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.