The Update List Attribute command allows you to define values for one or more List Attributes in a specific List.
The Update List Attribute command requires the following arguments: Command, Realm, Password, and Data grouping of List Attribute Name and Value.
api_web?r=myrealm&p=mypass&c=listattrupdate&list_id=5&list_attr_data=em_list_myattribute^myAttributeValue
The command is ‘listattrupdate', the realm is ‘myrealm’ and the password is ‘mypass’. The List Attribute named ‘em_list_myattribute’ will be updated with the value ‘myAttributeValue’ for the List with ID ‘5’.
NOTE: When a List Attribute is created, the 'em_list_' is prepended to the defined name and stored in all lower case characters. When updating the Attribute, the full name with the prepended string must be used in the Data portion of the command: myAttributeName becomes em_list_myattributename.
Example
Using listattrupdate with all commands and arguments (please note the command is wrapped for display purposes only):
api_web?r=myrealm&p=mypass&c=listattrupdate&list_id=5&list_attr_data=em_list_contactname,em_list_contactemail,em_list_city,em_list_state^Jane%20Doe,jane.doe@mydomain.com,Seattle,WA
Successful results return:
SUCCESS: attribute values updated
Results
The Update List Attribute commands output either a SUCCESS or FAILURE message.
Success
The command success message returns the SUCCESS message. The result format is:
SUCCESS: attribute values updated
Failure
The command will fail if a List Attribute with the same name does not exist, the List does not exist, or invalid data is defined. The result format is:
FAILURE: [Reason]
If the Data argument is not correctly formatted, the command will fail as:
FAILURE: Index: 1, Size: 1
Arguments
The command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=listattrupdate c=listattrupdate |
Realm |
Yes |
Name of the realm to run the command. This is required, and the command will fail if the realm and password do not match. |
realm=[realm_name] r=[realm_name] |
Password |
Yes |
Authentication code for API access. This is required, and the command will fail if the realm and password do not match. |
pwd=[password] p=[password] |
List ID |
Yes |
ID of the list to associate the Attribute. |
list_id=[list_id] |
Attribute Data |
Yes |
The name of the List Attribute(s) to update and values to store in comma separated list. |
list_attr_data=[name^value] |