[ZBX-4176] API "action.update" does not work properly Created: 2011 Sep 27  Updated: 2017 May 30  Resolved: 2011 Sep 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 1.8.8rc3, 1.9.7 (beta)
Fix Version/s: 1.8.9, 1.9.7 (beta)

Type: Incident report Priority: Critical
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: API, actions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

latest trunk r21920,
latest 1.8 branch r21863


Issue Links:
Duplicate

 Description   

Suppose we need to enable/disable an action by API.
And we want to use ONLY "actionid": parameter to select corresponding action.

Official documentation even has an examples with this operation, but it is partially wrong (actually disabled status is 1) and it does not work at all.
http://www.zabbix.com/documentation/1.8/api/action/update
http://www.zabbix.com/documentation/2.0/manual/appendix/api/action/update

Current trunk and 1.8 branch have different behavior.
In the trunk it works if we specify an action name (redundant data in our case)
1.8 branch does not work AT ALL.

See results of my tests:

                                                            • Zabbix 1.9 latest (trunk) ******************************

>>>>>>>>>>>>>>>>>>> OK <<<<<<<<<<<<<<<<<:
request:
{
"jsonrpc":"2.0",
"method":"action.update",
"params":

{ "actionid":"17", "name":"test19", "status":"1" }

,
"auth":"ebe9ea3b39b7b7f00b39a04b50b3fdc8",
"id":2
}
response:
{
"jsonrpc":"2.0",
"result":

{ "actionids":[ "17" ] }

,
"id":2
}

>>>>>>>>>>>>>>> BAD <<<<<<<<<<<<<<<<
request:
{
"jsonrpc":"2.0",
"method":"action.update",
"params":

{ "actionid":"17", "status":"1" }

,
"auth":"356d584f180937a9eeab315ba2935056",
"id":2
}
response:
{
"jsonrpc":"2.0",
"error":

{ "code":-32602, "message":"Invalid params.", "data":"Action \"\" already exists." }

,
"id":2
}

                                                            • Zabbix 1.8 ******************************

>>>>>>>>>>>>>>>>> BAD <<<<<<<<<<<<<<<<<<<<<<<
request:
{
"jsonrpc":"2.0",
"method":"action.update",
"params":

{ "actionid":"3", "name":"18test", "status":"1" }

,
"auth":"bfcbc8dc41438a20652f4e0a672df8e5",
"id":2
}
response:
{
"jsonrpc":"2.0",
"error":

{ "code":-32602, "message":"Invalid params.", "data":"[ CAction::update ] Incorrect parameter used for Action [ 18test ]" }

,
"id":2
}

>>>>>>>>>>>>>>>>>>>>> still BAD <<<<<<<<<<<<<<<<<<<<<<
request:
{
"jsonrpc":"2.0",
"method":"action.update",
"params":

{ "actionid":"3", "status":"1" }

,
"auth":"1e9508bf3a409223cf9f0e0dae39a866",
"id":2
}
response:
{
"jsonrpc":"2.0",
"error":

{ "code":-32602, "message":"Invalid params.", "data":"[ CAction::update ] Action [ ] already exists" }

,
"id":2
}

>>>>>>>>>>>>>>> still BAD #2 <<<<<<<<<<<<<<<<<
request:
{
"jsonrpc":"2.0",
"method":"action.update",
"params":

{ "actionid":"3", "name":"18test" }

,
"auth":"7c6bd9ad0bf753a520e4f1c9a2258c15",
"id":2
}
response:
{
"jsonrpc":"2.0",
"error":

{ "code":-32602, "message":"Invalid params.", "data":"[ CAction::update ] Incorrect parameter used for Action [ 18test ]" }

,
"id":2
}



 Comments   
Comment by Alexey Fukalov [ 2011 Sep 28 ]

svn://svn.zabbix.com/branches/dev/ZBX-4176

Comment by Alexey Fukalov [ 2011 Sep 29 ]

svn://svn.zabbix.com/branches/1.8 22066

Generated at Sat Apr 20 10:17:49 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.