Set User Metadata

How to set the user metadata #

Set the metadata for the user. This function will pass a JSON string of the metadata. The system will automatically add an email property to the user_data meta data. The user cannot set the email property, this is set by the backend.

This function will fail if the metaData requirements are not met and return a 604. Also, the metadata fields for a user can only be set if the fields are editable.

The metaData is the meta data JSON string

URL #
    /api/appuser/setUserMetadata
Method #
    POST
Headers #
    access-token: "<Access Token>"
Data Parameter #
    {
        metaData: "<JSON string of user meta data>" 
    }

Response: #

Success: #

StatusCode: #
200 (OK)
Contents: #
    true

Error: #

StatusCode: #
    400 (BAD REQUEST)
    500 (INTERNAL SERVER ERROR)
Content: #
    {
        code: "<internal error code>",
        message: "<readable error description>"
    }

The internal codes are integers:

  • 401 - app no longer exists
  • 402 - app is suspended
  • 403 - missing parameter
  • 404 - user account is suspended
  • 405 - invalid access token
  • 413 - app is migrated
  • 500 - internal server error
  • 602 - invalid data
  • 604 - invalid metadata