Ad Widget

Collapse

API (v1.8) usergroup.massupdate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mbrand5371
    Member
    • May 2009
    • 55

    #1

    API (v1.8) usergroup.massupdate

    Hi!

    I try to add users to an existing group by using ZABBIX API (V1.8).

    The UserID is: 104
    Code:
    mysql> select * from users;
    +--------+-------------+----------------------+-------------------------------------------------------+----------------------------------+----------------------------------------------------------------------+-----------+------------+-------+---------+------+-------------+----------------+---------------+---------------+---------------+
    | userid | alias       | name                 | surname                                               | passwd                           | url                                                                  | autologin | autologout | lang  | refresh | type | theme       | attempt_failed | attempt_ip    | attempt_clock | rows_per_page |
    +--------+-------------+----------------------+-------------------------------------------------------+----------------------------------+----------------------------------------------------------------------+-----------+------------+-------+---------+------+-------------+----------------+---------------+---------------+---------------+
    ...
    |    104 | strswe80    | xxxxx | xxxxxx | 5fce1b3e34b520afeffb37ce08c7cd66 |                                                                      |         0 |       3600 | en_gb |     120 |    1 | css_ob.css  |              0 |               |             0 |            25 |
    +--------+-------------+----------------------+-------------------------------------------------------+----------------------------------+----------------------------------------------------------------------+-----------+------------+-------+---------+------+-------------+----------------+---------------+---------------+---------------+
    The GroupID is: 32
    Code:
    mysql> select * from usrgrp;
    +----------+---------------------------------+------------+--------------+------------+------------+
    | usrgrpid | name                            | gui_access | users_status | api_access | debug_mode |
    +----------+---------------------------------+------------+--------------+------------+------------+
    ....
    |       32 | Dez-4_Users                 |          0 |            0 |          0 |          0 |
    .....
    +----------+---------------------------------+------------+--------------+------------+------------+
    10 rows in set (0.01 sec)
    API call is:
    Code:
    {"jsonrpc":"2.0","method":"usergroup.massUpdate","params":[{"usrgrpids": ["32"],"userids": ["104"]}],"auth":"f513ea5b1f48f7a9f3dd8c67d22db08b","id":0}
    Also tried:
    Code:
    {"jsonrpc":"2.0","method":"usergroup.massUpdate","params":{"usrgrpids": ["32"],"userids": ["104"]},"auth":"f513ea5b1f48f7a9f3dd8c67d22db08b","id":0}
    Code:
    {"jsonrpc":"2.0","method":"usergroup.massAdd","params":[{     "usrgrpids":"32",       "userids":"104"}],"auth":"60ffc74bc21f8044b35bc631660ad46c","id":0}
    Also tried but encountered an error msg:
    Code:
    {"jsonrpc":"2.0","method":"usergroup.massAdd","params":{"usrgrpids": ["32"],"userids": ["104"],},"auth":"1d9f4492dee9f53244bd8e1340fa3b2f","id":0}
    Return Code:
    Code:
    HTTP/1.1 200 OK
    {"jsonrpc":"2.0","result":true,"id":0}
    But the user still belongs to no group.
    Looking forward for our ideas, Marcus
    Last edited by mbrand5371; 13-06-2012, 18:29.
  • mbrand5371
    Member
    • May 2009
    • 55

    #2
    Seems i found the right one:
    Code:
    {"jsonrpc":"2.0","method":"usergroup.massAdd","params":{"usrgrpids": ["32"],"userids": ["104"]},"auth":"ea47cf30a0f7c6ba9fc229192b25ee6b","id":0}

    Comment

    Working...