The Create List Attribute command allows you to define and create a new List Attribute to use as a Template Tag in your content. Up to fifty (50)* attributes may be defined per Realm.
The Create List Attribute command requires the following arguments: Command, Realm, Password, and List Attribute Name.
api_web?r=myrealm&p=mypass&c=listattrcreate&list_attr_name=myAttribute
The command is ‘listattrcreate', the realm is ‘myrealm’ and the password is ‘mypass’. The new List Attribute named ‘em_list_myattribute’ will be created in all lower case characters.
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 or deleting 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 listattrcreate with all commands and arguments (please note the command is wrapped for display purposes only):
api_web?r=myrealm&p=mypass&c=listattrcreate&list_attr_name=city&list_attr_value=Seattle&list_id=5
Successful results return:
SUCCESS: attribute created
Results
The Create List commands output either a SUCCESS or FAILURE message.
Success
The command success message returns the SUCCESS message. The result format is:
SUCCESS: attribute created
Failure
The command will fail if a List Attribute with the same name already exists, ten attributes already exist, the List does not exist, or invalid data is defined. The result format is:
FAILURE: [Reason]
Arguments
The command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=listattrcreate c=listattrcreate |
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 |
|
ID of the list to associate the Attribute. |
list_id=[list_id] |
Attribute Name |
Yes |
The name of the List Attribute. |
list_attr_name=[name] |
Attribute Value |
|
The value to associate to the specified List. |
list_attr_value=[value] |
*Updated to allow 50 attributes in v12.03.