Admin Users
The admin/user resource can be used to manage M/Monit users.
Available methods:
GET |
/api/1/admin/users/list | The users list |
GET |
/api/1/admin/users/get | Details for a particular user |
POST |
/api/1/admin/users/create | Create a new user |
POST |
/api/1/admin/users/update | Update a user |
POST |
/api/1/admin/users/delete | Delete a user |
list
Returns a list of all M/Monit users.
curl -b ~/.mmonit/cookie \
http://127.0.0.1:8080/api/1/admin/users/list
Arguments
| none |
Output
| uname | The username used for login |
| fullname | The full name of the user |
| image |
Image basename or an empty string for default image. Images are located in the docroot/uploads directory
|
| title | The user's title |
| The user's email | |
| mobile | The cell-phone/mobile number |
| imname | The instant messaging address |
| imtype | The instant messaging type. E.g. Skype, MSN etc. |
[
{
"uname": "admin",
"fullname": "Administrator",
"image": "",
"title": "M/Monit Administrator",
"email": "admin@foo.bar",
"mobile": "123456",
"imname": "admin@gtalk.com",
"imtype": "Jabber"
},
{
"uname": "monit",
"fullname": "Monit",
"image": "id1405310131422.jpg",
"title": "Default User",
"email": "operator@foo.bar",
"mobile": "654321",
"imname": "",
"imtype": ""
}
]
get
Get details of the user with the given uname.
curl -b ~/.mmonit/cookie \
http://127.0.0.1:8080/api/1/admin/users/get?uname=monit
Arguments
| uname | string | required | The username to get |
Output
| uname | The username used for login |
| password | The MD5 hash of the user's password |
| fullname | The user's full name |
| image | Image basename or an empty string for default image. |
| title | The user's title |
| The user's email | |
| phone | The phone number |
| mobile | The cell-phone/mobile number |
| imname | The instant messaging address |
| imtype | The instant messaging type. E.g. Skype, MSN etc |
| admin | True if this user have admin rights otherwise false (default) |
{
"uname": "monit",
"password": "D9CFD4AF77E33817DE2160E0C1C7607C",
"fullname": "Monit",
"image": "id1405310131422.jpg",
"title": "Default User",
"email": "",
"phone": "123456",
"mobile": "654321",
"imname": "",
"imtype": "",
"admin": false
}
create
Create a new M/Monit user. Parameters with space in them must be URL encoded (space=%20) as curl won't do this
curl -b ~/.mmonit/cookie \
-d uname=test \
-d fullname=my%20test%20user \
-d password=secret \
http://127.0.0.1:8080/api/1/admin/users/create
Arguments
| uname | string | required | The username used for login |
| password | string | required | The user's password in clear text. M/Monit will convert it to a MD5 string and store that string in its database |
| fullname | string | required | The user's full name |
| title | string | optional | The user's title |
| string | optional | The user's email | |
| phone | string | optional | The phone number |
| mobile | string | optional | The cell-phone/mobile number |
| imname | string | optional | The instant messaging address |
| imtype | string | optional | The instant messaging type. E.g. Skype, MSN etc. |
| admin | boolean | optional | True if this user should have admin rights otherwise false (default) |
update
Update user in the M/Monit database. Parameters with space in them must be URL encoded (space=%20) as curl won't do this
curl -b ~/.mmonit/cookie \
-d uname=test \
-d fullname=my%20test%20user \
-d password=E3C355A823BA3D8F91ACF25C79A9A9A3 \
-d oldpassword=E3C355A823BA3D8F91ACF25C79A9A9A3 \
http://127.0.0.1:8080/api/1/admin/users/update
Arguments
| uname | string | required | The username used for login |
| password | string | required | The user's new password in clear text or if unchanged, the MD5 hash of the user's existing password |
| oldpassword | string | required | The MD5 hash of the user's previous password. A new password will be set if and only if it differs from oldpassword |
| fullname | string | required | The user's full name |
| title | string | optional | The user's title |
| string | optional | The user's email | |
| phone | string | optional | The phone number |
| mobile | string | optional | The cell-phone/mobile number |
| imname | string | optional | The instant messaging address |
| imtype | string | optional | The instant messaging type. E.g. Skype, MSN etc. |
| admin | boolean | optional | True if this user should have admin rights otherwise false (default) |
delete
Deletes the user with the given uname.
curl -b ~/.mmonit/cookie \
-d uname=test \
http://127.0.0.1:8080/api/1/admin/users/delete
Arguments
| uname | string | required | The username to delete |