This method sets account data into a user account. The method accepts a list of optional parameters each defining a field/object in the account. 

Note: This method is part of the Registration-as-a-Service and the Profile Management - IDS packages. Both packages are premium platforms that require separate activation. If neither are part of your site package, please contact your Gigya or contact us by filling in a support form on our site. You can also access the support page by clicking "Support" on the upper menu of Gigya's site.

Description

This method sets account data into a user's account. The method accepts a list of optional parameters each defining a field/object in the account. The parameters that are passed in the request modify the relevant fields, and the other fields remain unchanged.

 

Do not use this API to create new fields within your site schema, use accounts.setSchema for consistent results. Fields created with setAccountInfo have their write permissions automatically set to serverOnly, and must be manually changed using accounts.setSchema to clientModify if you want to access these fields via client-side Web SDK calls.

The properties listed on this page apply to full accounts, note that Lite accounts only have access to a subset of these properties. For detailed information on Lite Accounts, see the Lite Registration documentation.

 

Parameters

RequiredNameTypeDescription

UID*string

The unique ID of the user for which to set account data. Use either this parameter or regToken .

* You are required to pass only one of the parameters either UID or regToken.

regToken**string

The regToken  returned from accounts.initRegistrationaccounts.register or accounts.login API calls when the registration process has not been finalized. Please note that the regToken  you receive from Gigya is valid for only one hour. Calls passing a regToken are handled as client-side calls by the server: fields with a writeAccess permission of "server only" will be inaccessible. 

** When passing regToken , the call must be made over HTTPS .

addLoginEmailsstring A comma-separated list of emails that should be added to the user's login identifiers list, and can be used for login purposes.
conflictHandlingstringHow the server handles a "login identifier exists" conflict on a new account:
  • fail - (default) returns a "login identifier exists" error.
  • saveProfileAndFail - profile data is saved before returning error "OK with error login identifier exists".
dataJSON object

An object containing custom data. Any data that you want to store regarding the user which isn't part of the profile object can be stored here.

Note that when using this parameter for users that already have custom data stored, it is not necessary to set all the fields again. Just include the fields you want to change or add. For example, the following code adds a "car" field to the user's custom data with the value "Suzuki Alto", or, if a "car" field already exists, its value is changed to "Suzuki Alto". Any other fields in the custom data objects remain unchanged.

{'car':'Suzuki Alto'}
isActiveBoolean

This parameter allows disabling the account. This is only permitted when calling this method from server-side, attempting to disable an account from a client SDK will return an error.

If an account's isActive state is false, a user attempting to login will receive an 'Account is disabled' error, and if email is the site's Login Identifier, the same email can not be used to create a new account.

isLockedOutBooleanThis parameter has been deprecated. Use accounts.rba.unlock REST instead.
isVerifiedBoolean 

Indicates whether the account email(s) are verified.

*If you pass the value 'true', all unverified email addresses in the account will be flagged as verified.

Once an account has been verified it is immutable and can not be 'unverified'.

langstringThe language/locale of the current end-user. This is an incoming parameter of the setAccountInfo API and not a settable field for the user. When setting a user's Consent preferences this parameter is used and required if a consent that is being agreed to or updated has a Purpose Document defined and attaches the user consent to the correct localized consent version. You can find a list of supported language codes in Advanced Customizations and Localization.
muteWebhooksBooleanWhen set to true, no webhooks are triggered by the API call. The default value is false.
newPasswordstringThe new password to replace the old one. Use this parameter with  password . When passing the  securityQuestion  or  securityAnswer  parameters the  password  parameter is required.
Note: If this parameter is passed then the method must be called using HTTPS.
passwordstringThe old password to be changed. Use this parameter with  newPassword .
Note: If this parameter is passed then the method must be called using HTTPS.
preferencesJSON object

A  Preferences  Object containing consent data for this user. When manually passing subscription information for a user using this method, you can change only the value of the isConsentGranted Boolean parameter and tags (only when accompanied by a status change of isConsentGranted). When setting or updating a user's Consent you must pass the lang parameter also.

Note, however, that it is not necessary to pass the lang parameter when setting preferences via the Web SDK as it is passed implicitly by the SDK.

Passing this as an array is not supported.

profileProfile objectThe user's profile information as described in the Profile object. You may add data to the predefined Gigya fields. To add your own custom profile fields, use the data object.
removeLoginEmailsstringA comma-separated list of emails to be removed from the user's login identifiers list .
requirePasswordChangeBooleanWhen set to true the server will require a password change on the next login.
secretAnswerstringA secret answer to the secret question that can be used for verification. Use this parameter with  secretQuestion C hanging the secret answer will not work without providing the existing password ( password  parameter). This field is hashed and can not be extracted.
secretQuestionstringA secret question that can be used for verification. Use this parameter with secretAnswer . Changing the secret question will not work without providing the existing password ( password  parameter).
securityOverrideBooleanThe default value is "false". When set to "true", the API call does not require the oldPassword for setting the newPassword . It also does not require a password validation when setting the secret question and answer for the first time. Only users with _sites permissions are allowed to pass this parameter. Read more about Console Administration.
subscriptionsJSON objectA Subscriptions Object containing subscription data for this user. When manually passing subscription information for a user using this method, you can change only the value of the isSubscribed and tags parameters.
rbaJSON object

Sets the specified user's rba policy. Available properties include: 

  • riskPolicy - Determines the rule set from the defined rulesSets configured in accounts.rba.setPolicy or one of the default policies.
  • riskPolicyLocked - Determines whether the user can change their own riskPolicy. If true, only an admin can change the user's riskPolicy.

If accounts.rba.setPolicy.allowOverride is set to  no , this will return an error. You can delete a previously set override by setting the accounts.rba.setPolicy REST allowOverride value to  null .

Code example:

rba: {
      "riskPolicy": "low",
      "riskPolicyLocked": true
}

For setting a site's RBA Policy, see Accounts RBA Policy Object.

usernamestringThe user's new username that can be used as a login identifier, if the site's Login Identifier Policy allow that.
 createddateThe UTC time the account was created in ISO 8601 format, e.g. "2014-07-16T19:20:30Z". This property is set internally by Gigya and can not be edited.
regSourcestringA string representing the source of the registration. Can be used to set varying destination pages in accounts.setPolicies.
oldPasswordBoolean Deprecated . Use the password parameter instead.

Sample Requests

<script>
var exampleObject = {
    api: "accounts.setAccountInfo",
    params: {
        "UID":"Enter A Valid UID Here",
        "data":{"testField001":"newData_001"},
        "profile":{"firstName":"Haley","email":"1093ejdaassssdadadwwwwd9@fake.com"},
        "rba":{"riskPolicy":"failedLoginLockoutUser"}
    },
    langs: "all",
    containerId: "codeExampleHolderDiv"
}
</script>
<div id="codeExampleHolderDiv"></div>

 

FieldTypeDescription
validationErrorsarray

In case of a data validation errors (errorCode 400006), you will receive this field as an array of error objects. Each object represents a validation error regarding one of the following fields:  username, password, secretQuestion, secretAnswer, email. For example:

validationErrors: [
    {
      "errorCode": 400006,
      "message": "invalid password - minimum length of 6 characters is required",
      "fieldName": "password"
    },
    {
      "errorCode": 400006,
      "message": "wrong format",
      "fieldName": "profile.email"
    }
  ]
UIDstringWhen using a Lite User regToken, the user's UID is returned in the response.

{
    "statusCode": 200,
    "errorCode": 0,
    "statusReason": "OK",
    "callId": "ddb3f8e144c84cb5b1bc5f010bddab2b",
    "time": "2015-03-22T11:42:25.943Z"
}

Errors

Gigya defines specific error codes and messages that are used with the Accounts API. These errors are returned with the APIs, indicating that some information is incorrect or missing. 

This section describes the errors that are related to this API, the reasons for each error, and the expected next step.

 

<script>
$(document).ready(function() {
    lssdk.tableFixer();
	lssdk.ceg.run(exampleObject);
	lssdk.tables.fixTableBottoms('tVar3');
});
</script>