Update a user
Updates a back-office user; only the fields you send change. Covers name, email, status, role, password (your own requires currentPassword) and PIN access. You cannot manage a user whose role has more access than your own.
How to use it
- Get the user ID from List users and send only the fields to change.
- To change your own password also send currentPassword; an administrator resetting someone else's password does not need it.
- A role change is recorded in the role audit trail. You cannot edit a user, or assign a role, with more access than your own role.
BearerAuthAuthorizationBearer <JWT>id*integerID of the record.
int64application/json- body
password?|New password, only to change it. At least 8 characters with upper and lower case letters, a digit and a special character (@$!%*?&._^#).
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&._^#])[A-Za-z\d@$!%*?&._^#]+$8 <= length <= 255currentPassword?|Current password. Required only when you change your own password; ignored when resetting someone else's.
enablePin?|Turn PIN access on or off. Omit to leave unchanged; turning it off removes the stored PIN.
pin?|New PIN, 4 to 6 digits. Required when enabling PIN access and no PIN is stored yet.
^\d{4,6}$roleId?|New role ID from List roles. Omit to keep the current role. The change is recorded in the role audit trail.
int64firstName?|New first name, up to 255 characters. Omit to keep.
0 <= length <= 255lastName?|New last name, up to 255 characters. Omit to keep.
0 <= length <= 255email?|New email address; must be a valid email. Omit to keep.
status?|Account status: active or inactive (case-insensitive). Omit to keep.
^(?i)(active|inactive)$OK
*/*- response
status*stringOutcome of the call: SUCCESS when the request worked, ERROR when it did not.
message*stringShort human-readable message describing the result, for logs or display; do not parse it.
data?The user's profile as it now stands. Passwords and PINs are never returned.
curl -X PUT 'https://beta.iotoms.com/api/v1/management/users/0' \ -H 'Content-Type: application/json' \ -d '{}'{ "status": "string", "message": "string", "data": { "userId": 0, "username": "string", "roleId": 0, "enablePin": true, "firstName": "string", "lastName": "string", "email": "string", "passwordUpdatedOn": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "status": "string" }}