UserAttr.update - REST API

Overview

Updates an existing user attribute, optionally encrypting it before it is saved in the database. It is also possible to set expiry for an attribute, upon reaching of which the attribute will be no longer available.

While the call's Python equivalent has two versions, one for individual and the other for multiple attributes, with REST there is a single endpoint to cover both cases. Yet, just like in the Python call, it is more efficient to update multiple attributes in one REST call instead of repeatedly updating individual ones.

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

Request

NameDatatypeOptionalNotes
uststring---Current user's session token (UST)
current_appstring---Name of application that the call is attempted from
user_idstringYesID of the user to update an attribute or attributes of
namestringYesIf a single attribute is to be updated, the attribute's name
valuestringYesIf a single attribute is to be updated, the attribute's value
datalistYesIf multiple attributes are to be updated, a list of dictionaries, each describing an individual attribute, like in the update_many Python API
encryptboolYesShould the attribute's new value be encrypted before it is saved to the database. Defaults to False.
expirationintYesAfter how many seconds from current time the attribute should expire. By default it will never expire.

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

$ curl -XPATCH localhost:17010/zato/sso/user/attr -d '
  {
    "current_ust": "gAAAAABavk-65BuvKI0JFPeu...",
    "current_app": "CRM",
    "user_id": "zusr6fh6fdgd4997ksjkpx7qnk659q",
    "name": "my-rest-attribute",
    "value": "my-rest-value",
    "encrypt": true,
    "expiration": 3600
  }
  '

  {
    "status": "ok",
    "cid": "2c1ff1c2de7b2cecb411c71a"
  }