Skip to main content

updateUser

A MoogDb v2 method that updates an existing user, by passing an object containing user information.

Back to MoogDb V2 API Method Reference.

Request arguments

Method updateUser takes the following request arguments:

Name

Type

Required

Description

userObj

Object

Yes

Object containing the user details.

The user object userObj contains the following information:

Name

Type

Required

Description

username

String

No, if you use uid.

Username of the user to be updated.

uid

Number

No, if you use username.

User ID of the user to be updated.

password

String

No

New user password, only valid for DB realm.

active

Boolean

No

Set to true if the user is active, false if the user is inactive. Default is true.

email

String

No

User's email address.

fullname

String

No

User's full name.

roles

JSON Array

No

List of either the role IDs or the role names. For example, "roles":["Super User"].

primary_group

String or Number

No

User's primary group name or primary group ID.

department

String or Number

No

User's department ID or department name.

timezone

String

No

User's timezone.

contact_num

String

No

User's phone number.

session_expiry

Number

No

Number of minutes after which the user's session expires. Default is the system default.

competencies

JSON Array

No

A list with the user competencies. Each competency should have have name or cid and ranking. For example:

[
        {"name":"SunOS", "ranking": 40},
        {"name":"SAP", "ranking": 50},
        {"name":"EMC", "ranking": 60}
]

team

JSON Array of Numbers or Strings

No

List of the user's team names or team IDs.

Response

Method updateUser returns the following response:

Examples

The following examples demonstrate typical use of method updateUser:

Request example

Example request to update a number of fields in user ID 5:

{
    "uid": 5,
    "fullname": "Phil Customer",
    "competencies": [
    {
        "name": "SunOS",
        "ranking": 40
    },
    {
        "name": "SAP",
        "ranking": 50
    },
    {
        "name": "EMC",
        "ranking": 60
    }],
    "roles": ["Super User"],
    "department": 3,
    "active": true,
    "email": "phil@example.com",
    "timezone": "(GMT 00:00) Europe/Jersey - Greenwich Mean Time",
    "teams": [1, 2, 4],
    "joined": 12345678,
    "contact_num": "0965412345"
}

Response example