User.update - REST API

Overview

Updates a user. If UST only is on input, user whose session it is will be updating his or her own account. If user_id is given, current session must belong to a super-user who will be updating another person's account by the latter's ID.

If a particular parameter is not sent, its current value will be left intact. If it sent but with a JSON value of 'null', it will be set to NULL on SQL level (if it is allowed to be nullable).

  • HTTP method: PATCH
  • URL path: /zato/sso/user

Request

NameDatatypeOptionalNeeds super-userNotes
uststring------Current user's session token (UST)
current_appstring------Name of application that the call is attempted from
user_idstringYesYesID of a user to update. May be provided only if input ust belongs to a super-user.
emailstringYes---E-mail
display_namestringYes---Display name
first_namestringYes---First name
middle_namestringYes---Middle name
last_namestringYes---Last name
is_totp_enabledboolYes---Should TOTP-based two factor authentication be enabled for user
totp_keystringYes---User's TOTP key, one will be auto-generated for user if it is not given on input, even if is_totp_enabled is False
totp_labelstringYes---An arbitrary label assigned to user's TOTP key for convenience
is_lockedboolYesYesShould this account be locked?
password_expirystringYesYesWhen will that account's password expire?
password_must_changeboolYesYesIs the user required to change password on next login?
sign_up_statusstringYesYesSignup process status, accepted values are: before_confirmation, to_approve, final
approval_statusstringYesYesApproval status, accepted values are: before_decision, approved, rejected

Response

NameDatatypeOptionalNotes
cidstring---Correlation ID assigned to request
statusstring---Overall status code
sub_statuslistYesReturned only if status is not "ok", a list of error or warning codes

Usage

  • Input user is a regular one who is changing his or her own display name and email:
$ curl -XPATCH localhost:17010/zato/sso/user -d '
  {
    "ust":          "gAAAAABalTp...",
    "current_app":  "CRM",
    "display_name": "My Name",
    "email":        "user@example.com"
  }
  '

  {
  "cid": "6f916246696fbdd76f8a7073",
  "status": "ok"
  }
$
  • Input user is a super-user who is changing display name and password expiry of another user:
$ curl -XPATCH localhost:17010/zato/sso/user -d '
  {
    "ust":             "gAAAAABalYT...",
    "user_id":         "zusrx2efj1q1h98n9q00tgx8scefv",
    "display_name":    "My Name",
    "password_expiry": "2030-12-31T23:59:59"
  }
  '

  {
    "cid": "de00deb0471188dcdd9913a8",
    "status": "ok"
  }