Profile API reference

Update user attributes

Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Cordova
Flutter
Xamarin

updateUserAttribute

Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
Remember the following information:
  • If the attribute does not exist, it will be created.
  • If the attribute exists, the value will be updated.
  • A null attribute value removes the attribute.

Syntax

1
public static void updateUserAttribute(String attributeName,
2
Object attributeValue)
Copied!

Example

You want to update username of a user obtained in the log in page :
1
UserProfile.updateUserAttribute("username", "Will Smith");
Copied!

updateUserAttributes

Sets the user profile attributes key and value.
Allows you to create/update a batch of user profile attributes:
  • String, Integer, Boolean, Double, Array, Map are valid type of user profile attributes.
  • Custom objects cannot be saved as a UserProfile attribute.
  • If the attribute does not exist, it is created.
  • If the attribute already exists, the value is updated.
  • A null attribute value will remove the attribute.

Syntax

1
public static void updateUserAttributes(Map<String, Object> attributeMap)
Copied!

Example

You want to update username, usertype of a user obtained in the log in page :
1
HashMap<String, Object> profileMap = new HashMap<>();
2
profileMap.put("username","Will Smith");
3
profileMap.put("usertype","Actor");
4
UserProfile.updateUserAttributes(profileMap);
Copied!

updateUserAttributes

Sets the user profile attributes key and value.
Allows to create/update a batch of user profile attributes:
  • String, Integer, Boolean, Double, Array, Map are valid type of user profile attributes.
  • We do not allow custom objects to be saved as a UserProfile attribute.
  • If the attribute already exists, then the value will be updated.
  • If the attribute does not exist, it will be created.
A null attribute value will remove the attribute.

Syntax

1
public static func updateUserAttributes(attributeDict: [String: Any])
Copied!

Examples

You want to update username, usertype of a user obtained in the log in page :
Objective C
1
NSMutableDictionary *profileMap = [NSMutableDictionary dictionary];
2
[profileMap setObject:@"username" forKey:@"will_smith"];
3
[profileMap setObject:@"usertype" forKey:@"Actor"];
4
[AEPMobileUserProfile updateUserAttributes:profileMap];
Copied!
Swift
1
var profileMap = [AnyHashable: Any]()
2
profileMap["username"] = "will_smith"
3
profileMap["usertype"] = "Actor"
4
UserProfile.updateUserAttributes(attributeDict: profileMap)
Copied!

updateUserAttribute

Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
Remember the following information:
  • If the attribute does not exist, it will be created.
  • If the attribute already exists, then the value will be updated.
  • A null attribute value will remove the attribute.

Syntax

1
+ (void) updateUserAttribute: (nonnull NSString*) attributeName withValue: (nullable NSString*) attributeValue;
Copied!

Examples

You want to update username of a user obtained in the log in page:
Objective-C
1
[ACPUserProfile updateUserAttribute:@"username" withValue:@"Will Smith"];
Copied!
Swift
1
ACPUserProfile.updateUserAttribute("username", withValue: "Will Smith");
Copied!

updateUserAttributes

Sets the user profile attributes key and value.
Allows to create/update a batch of user profile attributes:
  • String, Integer, Boolean, Double, Array, Map are valid type of user profile attributes.
  • We do not allow custom objects to be saved as a UserProfile attribute.
  • If the attribute already exists, then the value will be updated.
  • If the attribute does not exist, it will be created.
A null attribute value will remove the attribute.

Syntax

1
+ (void) updateUserAttributes: (nonnull NSDictionary*) attributeMap
Copied!

Examples

You want to update username, usertype of a user obtained in the log in page :
Objective C
1
NSMutableDictionary *profileMap = [NSMutableDictionary dictionary];
2
[profileMap setObject:@"username" forKey:@"will_smith"];
3
[profileMap setObject:@"usertype" forKey:@"Actor"];
4
[ACPUserProfile updateUserAttributes:profileMap];
Copied!
Swift
1
var profileMap = [AnyHashable: Any]()
2
profileMap["username"] = "will_smith"
3
profileMap["usertype"] = "Actor"
4
ACPUserProfile.updateUserAttributes(profileMap)
Copied!

updateUserAttribute

Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
Remember the following information:
  • If the attribute does not exist, it will be created.
  • If the attribute exists, the value will be updated.
  • A null attribute value removes the attribute.

Syntax

1
ACPUserProfile.updateUserAttribute = function(attributeName, attributeValue, success, fail);
Copied!
  • attributeName is a string containing the name of the user profile attribute to create or update.
  • attributeValue must be a string, number, or array containing the user profile attribute value.
  • success is a callback containing a general success message if the updateUserAttribute API executed without any errors.
  • fail is a callback containing error information if the updateUserAttribute API was executed with errors.

Example

You want to update username of a user obtained in the log in page :
1
ACPUserProfile.updateUserAttribute("username", "Will Smith", handleCallback, handleError);
Copied!

updateUserAttributes

Sets the user profile attributes key and value.
Allows you to create/update a batch of user profile attributes:
  • String, Number, and Array are valid types of user profile attributes.
  • Custom objects cannot be saved as a UserProfile attribute.
  • If the attribute does not exist, it is created.
  • If the attribute already exists, the value is updated.
  • A null attribute value will remove the attribute.

Syntax

1
ACPUserProfile.updateUserAttributes = function(attributes, success, fail);
Copied!
  • attributes is a object containing a batch of user profile attributes to create or update.
  • success is a callback containing a general success message if the updateUserAttributes API executed without any errors.
  • fail is a callback containing error information if the updateUserAttributes API was executed with errors.

Example

You want to update username, usertype of a user obtained in the log in page :
1
var username = "will_smith";
2
var usertype = "Actor";
3
var attributes = {"username":username, "usertype":usertype};
4
ACPUserProfile.updateUserAttributes(attributes, handleCallback, handleError);
Copied!

updateUserAttribute

Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
Remember the following information:
  • If the attribute does not exist, it will be created.
  • If the attribute exists, the value will be updated.
  • A null attribute value removes the attribute.

Syntax

1
static Future<void> updateUserAttribute(String attributeName, String attributeValue) async
Copied!
  • attributeName is a string containing the name of the user profile attribute to create or update.
  • attributeValue must be a string, number, or array containing the user profile attribute value.

Example

You want to update username of a user obtained in the log in page :
1
FlutterACPUserProfile.updateUserAttribute("username", "Will Smith");
Copied!

updateUserAttributes

Sets the user profile attributes key and value.
Allows you to create/update a batch of user profile attributes:
  • String, Number, and Array are valid types of user profile attributes.
  • Custom objects cannot be saved as a UserProfile attribute.
  • If the attribute does not exist, it is created.
  • If the attribute already exists, the value is updated.
  • A null attribute value will remove the attribute.

Syntax

1
static Future<void> updateUserAttributes(Map<String, Object> attributeMap) async
Copied!
  • attributeMap is a object containing a batch of user profile attributes to create or update.

Example

You want to update username, usertype of a user obtained in the log in page :
1
FlutterACPUserProfile.updateUserAttributes({"username":"will_smith", "usertype":"Actor"});
Copied!

updateUserAttribute

Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
Remember the following information:
  • If the attribute does not exist, it will be created.
  • If the attribute exists, the value will be updated.
  • A null attribute value removes the attribute.

Syntax

Android
1
public unsafe static void UpdateUserAttribute (string attributeName, Java.Lang.Object attributeValue);
Copied!
  • attributeName is a string containing the name of the user profile attribute to create or update.
  • attributeValue must be a String, Integer, Boolean, Double, Array, or Map containing the user profile attribute value. Custom objects cannot be saved as a UserProfile attribute.
iOS
1
public static void UpdateUserAttribute (string attributeName, string attributeValue);
Copied!
  • attributeName is a string containing the name of the user profile attribute to create or update.
  • attributeValue is a string containing the user profile attribute value.

Example

You want to update username of a user obtained in the log in page :
1
ACPUserProfile.updateUserAttribute("username", "Will Smith");
Copied!

updateUserAttributes

Sets the user profile attributes key and value.
Allows you to create/update a batch of user profile attributes:
  • String, Integer, Boolean, Double, Array, or Map are valid types of user profile attributes.
  • Custom objects cannot be saved as a UserProfile attribute.
  • If the attribute does not exist, it is created.
  • If the attribute already exists, the value is updated.
  • A null attribute value will remove the attribute.

Syntax

Android
1
public unsafe static void UpdateUserAttributes (IDictionary<string, Java.Lang.Object> attributeMap);
Copied!
  • attributeMap is a object containing a batch of user profile attributes to create or update.
iOS
1
public static void UpdateUserAttributes (NSDictionary attributeMap);
Copied!
  • attributeMap is a object containing a batch of user profile attributes to create or update.

Example

You want to update username, usertype of a user obtained in the log in page :
Android
1
var attributes = new Dictionary<string, Java.Lang.Object>();
2
attributes.Add("username", "will_smith");
3
attributes.Add("usertype", "Actor");
4
ACPUserProfile.UpdateUserAttributes(attributes);
Copied!
iOS
1
var attributes = new NSMutableDictionary<NSString, NSString>
2
{
3
["username"] = new NSString("will_smith"),
4
["usertype"] = new NSString("Actor")
5
};
6
ACPUserProfile.updateUserAttributes(attributes);
Copied!

Remove user attributes

Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Cordova
Flutter
Xamarin

removeUserAttribute

Removes the user profile attribute for the given key.

Syntax

1
public static void removeUserAttribute(String attributeName)
Copied!

Example

A retail application wants to remove the itemsAddedToCart user data after the product is purchased.
1
UserProfile.removeUserAttribute("itemsAddedToCart");
Copied!

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

1
public static void removeUserAttributes(List<String> attributeNames)
Copied!

Example

You want to remove username, usertype user data when session timeout occurs.
1
UserProfile.removeUserAttributes(Arrays.asList("username", "usertype"));
Copied!

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

1
public static void removeUserAttributes(List<String> attributeNames)
Copied!

Example

You want to remove username, usertype user data when session timeout occurs.
1
UserProfile.removeUserAttributes(Arrays.asList("username", "usertype"));
Copied!

removeUserAttribute

Removes the user profile attribute for the given key.

Syntax

1
+ (void) removeUserAttribute: (nonnull NSString*) key
Copied!

Examples

A retail application wants to remove the itemsAddedToCart user data after the product is purchased.
Objective C
1
[ACPUserProfile removeUserAttribute:@"itemsAddedToCart"];
Copied!
Swift
1
ACPUserProfile.removeUserAttribute("itemsAddedToCart");
Copied!

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

1
+ (void) removeUserAttributes: (nonnull NSArray <NSString*>*) attributeNames
Copied!

Examples

You want to remove username, usertype user data when session timeout occurs.
Objective C
1
[ACPUserProfile removeUserAttributes:@[@"username", @"usertype"]]
Copied!
Swift
1
ACPUserProfile.removeUserAttributes(["username","usertype"]);
Copied!

removeUserAttribute

Removes the user profile attribute for the given key.

Syntax

1
ACPUserProfile.removeUserAttribute = function(attributeName, success, fail);
Copied!
  • attributeName is a string containing the name of the user profile attribute to remove.
  • success is a callback containing a general success message if the removeUserAttribute API executed without any errors.
  • fail is a callback containing error information if the removeUserAttribute API was executed with errors.

Example

A retail application wants to remove the itemsAddedToCart user data after the product is purchased.
1
ACPUserProfile.removeUserAttribute("itemsAddedToCart", handleCallback, handleError);
Copied!

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

1
ACPUserProfile.removeUserAttributes = function(attributeNames, success, fail);
Copied!
  • attributeNames is an array of strings containing the names of user profile attributes to remove.
  • success is a callback containing a general success message if the removeUserAttributes API executed without any errors.
  • fail is a callback containing error information if the removeUserAttributes API was executed with errors.

Example

You want to remove username, usertype user data when session timeout occurs.
1
var attributeNames = new Array();
2
attributeNames.push("username");
3
attributeNames.push("usertype");
4
ACPUserProfile.removeUserAttributes(attributeNames, handleCallback, handleError);
Copied!

removeUserAttribute

Removes the user profile attribute for the given key.

Syntax

1
static Future<void> removeUserAttribute(String attributeName) async
Copied!
  • attributeName is a string containing the name of the user profile attribute to remove.

Example

A retail application wants to remove the itemsAddedToCart user data after the product is purchased.
1
FlutterACPUserProfile.removeUserAttribute("itemsAddedToCart");
Copied!

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

1
static Future<void> removeUserAttributes(List<String> attributeName) async
Copied!
  • attributeName is an array of strings containing the names of user profile attributes to remove.

Example

You want to remove username, usertype user data when session timeout occurs.
1
FlutterACPUserProfile.removeUserAttributes(["username", "usertype"])
Copied!

removeUserAttribute

Removes the user profile attribute for the given key.

Syntax

Android
1
public unsafe static void RemoveUserAttribute (string attributeName);
Copied!
  • attributeName is a string containing the name of the user profile attribute to remove.
iOS
1
public static void RemoveUserAttribute (string attributeName);
Copied!
  • attributeName is a string containing the name of the user profile attribute to remove.

Example

A retail application wants to remove the itemsAddedToCart user data after the product is purchased.
1
ACPUserProfile.RemoveUserAttribute("itemsAddedToCart");
Copied!

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

Android
1
public unsafe static void RemoveUserAttributes (IList<string> attributeNames);
Copied!
  • attributeNames is an IList containing the names of user profile attributes to remove.
iOS
1
public static void RemoveUserAttributes (string[] attributeNames);
Copied!
  • attributeNames is an array of strings containing the names of user profile attributes to remove.

Example

You want to remove username, usertype user data when session timeout occurs.
Android
1
var attributes = new List<string>();
2
attributes.Add("username");
3
attributes.Add("usertype");
4
ACPUserProfile.RemoveUserAttributes(attributes);
Copied!
iOS
1
string[] attributes = new string[] { "username", "usertype" };
2
ACPUserProfile.RemoveUserAttributes(attributes);
Copied!

Get user attributes

Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Cordova
Flutter
Xamarin

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

1
public static void getUserAttributes(List<String> keys, AdobeCallback<Map<String, Object>> callback)
Copied!
  • callback is invoked after the customer attributes are available.

Example

A retail application wants to get the itemsAddedToCart user data when processing checkout.
When AdobeCallbackWithError is provided, if the operation times out (5s) or an unexpected error occurs, the fail method is called with the appropriate AdobeError.
1
UserProfile.getUserAttributes(Arrays.asList("itemsAddedToCart"), new AdobeCallbackWithError<Map<String, Object>>() {
2
@Override
3
public void fail(AdobeError adobeError) {
4
// your customized code
5
}
6
@Override
7
public void call(Map<String, Object> stringObjectMap) {
8
// your customized code
9
}
10
});
Copied!

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

1
static func getUserAttributes(attributeNames: [String], completion: @escaping ([String: Any]?, AEPError) -> Void)
Copied!
  • completion is the callback function which will be called with user attributes.

Example

A retail application wants to get the itemsAddedToCart user data when processing checkout.
When the callback is provided, if the operation times out (5s) or an unexpected error occurs, the completion method is called with the appropriate AEPError.
1
UserProfile.getUserAttributes(attributeNames: ["itemsAddedToCart"]) { attributes, error in
2
// your customized code
3
}
Copied!

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

1
+ (void) getUserAttributes: (nullable NSArray <NSString*>*) attributNames withCompletionHandler: (nonnull void (^) (NSDictionary* __nullable userAttributes, NSError* _Nullable error)) completionHandler
Copied!
  • completionHandler is invoked after the customer attributes are available, or error if an unexpected error occurs or the request times out. The default timeout is 5s.

Examples

A retail application wants to get the itemsAddedToCart user data when processing checkout.
Objective C
1
[ACPUserProfile getUserAttributes:attributes withCompletionHandler:^(NSDictionary* dict, NSError* error){
2
// your customized code
3
}];
Copied!
Swift
1
ACPUserProfile.getUserAttributes(["itemsAddedToCart"], withCompletionHandler: {(dict: [AnyHashable: Any]?, error: Error?) -> Void in
2
// your customized code
3
})
Copied!

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

1
ACPUserProfile.getUserAttributes = function(attributeNames, success, fail);
Copied!
  • attributeNames is an array of strings containing the names of user profile attributes to retrieve.
  • success is a callback containing the retrieved user profile attributes.
  • fail is a callback containing error information if the getUserAttributes API was executed with errors.

Example

A retail application wants to get the itemsAddedToCart user data when processing checkout.
1
var attributeNames = new Array();
2
attributeNames.push("itemsAddedToCart");
3
ACPUserProfile.getUserAttributes(attributeNames, handleCallback, handleError);
Copied!

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

1
static Future<String> getUserAttributes(List<String> attributeKeys) async
Copied!
  • attributeKeys is an array of strings containing the names of user profile attributes to retrieve.

Example

A retail application wants to get the itemsAddedToCart user data when processing checkout.
1
try {
2
result = await FlutterACPUserProfile.getUserAttributes(["itemsAddedToCart"]);
3
} on PlatformException {
4
log("Failed to get the user attributes");
5
}
Copied!

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

Android
1
public unsafe static void GetUserAttributes (IList<string> keys, IAdobeCallback callback);
Copied!
  • keys is an IList containing the names of user profile attributes to retrieve.
iOS
1
public unsafe static void GetUserAttributes (string[] attributNames, [BlockProxy (typeof(ObjCRuntime.Trampolines.NIDActionArity2V0))] Action<NSDictionary, NSError> completionHandler);
Copied!
  • attributNames is an array of strings containing the names of user profile attributes to remove.

Example

A retail application wants to get the itemsAddedToCart user data when processing checkout.
Android
1
var keysToRetrieve = new List<string>();
2
keysToRetrieve.Add("itemsAddedToCart");
3
ACPUserProfile.GetUserAttributes(keysToRetrieve, new AdobeCallback());
4
5
class AdobeCallback : Java.Lang.Object, IAdobeCallbackWithError
6
{
7
public void Fail(AdobeError error)
8
{
9
Console.WriteLine("GetUserAttributes error: " + error.ToString());
10
}
11
12
public void Call(Java.Lang.Object retrievedAttributes)
13
{
14
if (retrievedAttributes != null)
15
{
16
var attributesDictionary = new Android.Runtime.JavaDictionary<string, object>(retrievedAttributes.Handle, Android.Runtime.JniHandleOwnership.DoNotRegister);
17
foreach (KeyValuePair<string, object> pair in attributesDictionary)
18
{
19
Console.WriteLine("[ " + pair.Key + " : " + pair.Value + " ]");
20
}
21
}
22
else
23
{
24
Console.WriteLine("GetUserAttributes callback is null.");
25
}
26
}
27
}
Copied!
iOS
1
var callback = new Action<NSDictionary, NSError>(handleCallback);
2
var keysToRetrieve = new string[] { "itemsAddedToCart" };
3
ACPUserProfile.GetUserAttributes(keysToRetrieve, callback);
4
5
private void handleCallback(NSDictionary content, NSError error)
6
{
7
if (error != null)
8
{
9
Console.WriteLine("GetUserAttributes error: " + error.DebugDescription);
10
}
11
else if (content == null)
12
{
13
Console.WriteLine("GetUserAttributes callback is null.");
14
}
15
else
16
{
17
var attributesDictionary = (NSDictionary)content;
18
foreach (KeyValuePair<NSObject, NSObject> pair in attributesDictionary)
19
{
20
Console.WriteLine("[ " + pair.Key + " : " + pair.Value + " ]");
21
}
22
}
23
}
Copied!
Last modified 3mo ago