Zabbix Documentation 1.8

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


api:user:create

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

api:user:create [2014/09/25 14:40] (current)
sasha Page moved from 1.8:api:user:create to api:user:create
Line 1: Line 1:
 +===== create() =====
 +This function allows you to create a user as defined by the **user data** array. Available only to super admins.
  
 +==== Parameters ====
 +^Parameter^Type^Optional^Description^Details^
 +|**user data**|//​array or object//| No |Array of user objects or a single object|**userid** shouldn'​t be specified |
 +|**usrgrps**|//​array//​| No |User groups to add user to. | |
 +|**user_medias**|//​array//​| No |Create user media for user. | |
 +
 +====Returns====
 +^Parameter^Description^
 +|**result**|Operation successful. Result will contain an array of created user IDs. **userid** is assigned to each user object. ​ |
 +|**error**|In case of any errors. ​ |
 +==== Example ====
 +Create new user and add it to 3 user groups. Password "​zabbix"​ will automatically be encoded by MD5 hash function.
 +<​code>​
 +{
 +"​jsonrpc":"​2.0",​
 +"​method":"​user.create",​
 +"​params":​[{
 + "​usrgrps":​[{
 + "​usrgrpid":"​100100000000009",​
 + "​name":"​Internal login"
 + },{
 + "​usrgrpid":"​100100000000020",​
 + "​name":"​API access"​
 + },{
 + "​usrgrpid":"​100100000000022",​
 + "​name":"​Debug group"
 + }],
 + "​alias":"​Test User",
 + "​name":"​Test User Name",
 + "​surname":"​Test User Surname",​
 + "​passwd":"​zabbix",​
 + "​url":"",​
 + "​autologin":"​0",​
 + "​autologout":"​600",​
 + "​lang":"​en_gb",​
 + "​refresh":"​90",​
 + "​type":"​1",​
 + "​theme":"​css_ob.css",​
 + "​attempt_failed":"​0",​
 + "​attempt_ip":"",​
 + "​attempt_clock":"​0",​
 + "​rows_per_page":"​50"​
 +}],
 +"​auth":"​038e1d7b1735c6a5436ee9eae095879e",​
 +"​id":​3
 +}
 +</​code>​
 +
 +User added successfully:​
 +<​code>​
 +{
 +"​jsonrpc":"​2.0",​
 +"​result":​{
 +   "​userids":​ ["​107819"​]
 +},
 +"​id":​3
 +}
 +</​code>​
 +
 +User already exists:
 +
 +<​code>​
 +{
 +"​jsonrpc":"​2.0",​
 +"​error":​{
 +      "​code":​-32602,​
 +      "​message":"​Invalid params.",​
 +      "​data":"​[ CUser::​create ] User [ Admin ] already exists"​
 +},
 +"​id":​3
 +}
 +</​code>​