Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Updating User Accounts

Updating User Accounts

The user account update operation is a data operation that allows you to modify the fields of the user account object stored in the Users content type.

In this article:

Single User

To update a single user account, you need to specify its Id in the request URL. Then build a JavaScript object containing the properties to update and their new values and pass it as the request body.

Request:
    PUT https://api.everlive.com/v1/your-app-id/type-name/item-id
Headers:
    Authorization  Bearer your-access-token
    Content-Type: application/json
Body:
    {
        "DisplayName":"Harper Lee",
        "Email" : "harper.lee@mail.com"
   }

Response:
    Status: 200 OK
    Content-Type: application/json
    Body:
    {
        "ModifiedAt":"2017-01-24T09:16:56.198Z",
        "Result":1
    }
var updateObject = {
    "DisplayName":"Harper Lee",
    "Email" : "harper.lee@mail.com"
};

$.ajax({
    type: "PUT",
    url: 'https://api.everlive.com/v1/your-app-id/Users/item-id',
    headers: { "Authorization" : "Bearer your-access-token" },
    contentType: "application/json",
    data: JSON.stringify(updateObject),
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
});

Multiple Users

If you completely omit the user Id from the Users endpoint, you will be updating all users. Include filter criteria using the X-Everlive-Filter header to narrow down the list.

You cannot update the following fields with this operation:

  • Username
  • Email
  • Password

The following example filters user accounts on a custom Region field and then sets a single value ShowPrivacyWarning to true for all matching user accounts.

Request:
    PUT https://api.everlive.com/v1/your-app-id/Users
Headers:
    Authorization  Bearer your-access-token
    X-Everlive-Filter  { "Region" : "EMEA" }
Body:
    {
        "ShowPrivacyWarning" : true
    }

Response:
    Status: 200 OK
    Content-Type: application/json
    Body:
    {
        "ModifiedAt":"2017-01-24T09:16:56.198Z",
        "Result":29773
    }
var filter = {
    "Region":"EMEA"
};
var updateObject = {
    "ShowPrivacyWarning" : true
};

$.ajax({
    type: "PUT",
    url: 'https://api.everlive.com/v1/your-app-id/Users',
    headers: {"Authorization" : "Bearer your-access-token",
             "X-Everlive-Filter" : JSON.stringify(filter)},
    contentType: "application/json",
    data: JSON.stringify(updateObject),
    success: function (data) {
        alert(JSON.stringify(data));
    },
    error: function (error) {
        alert(JSON.stringify(error));
    }
});

Secret Question and Answer Fields

The update operation can set the SecretQuestionId and SecretAnswer user object fields needed when recovering a forgotten password, just like most other fields. However, even if the current user account has update permissions on the Users content type, you can use it to set only the account's own pair of fields.

Password Field

The password is a part of the Telerik Platform security mechanism and cannot be set with a simple UPDATE request to the Users content type. If you specify a password, it will be ignored.

Read more about changing passwords in Changing a User Account Password.

Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.