Arguments
The Create Custom Field command requires the following arguments: Command, Realm, Password, Field Name, Field Type, and Description.
api_web?r=myrealm&p=mypass&c=customfieldcreate&fieldname=age&fieldtype=0&description=Age
The command is ‘customfieldcreate', the realm is ‘myrealm’ and the password is ‘mypass’. The new, empty Number custom field will be named ‘age’.
The Create Custom Field command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=[customfieldcreate] c=[customfieldcreate] |
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] |
Field Name |
Yes |
Name of the new custom field. Please note that custom fields are case sensitive and long names are prone to error. Many special characters, such as space, are not allowed. |
fieldname=[custom_field_name] |
Field Type | Yes |
The type of value to store in the field. Field types include: number = 0 text = 1 date = 2 large text = 3 unicode text = 6 float = 7 |
fieldtype=[0,1,2,3,6,7]
|
Description |
Yes |
A short description of the value to store in the field. |
description=[field_description] |
Example
Using all commands and arguments (please note the command is wrapped for display purposes only):
api_web?r=myrealm&p=mypass&c=customfieldcreate&fieldname=gender&fieldtype=1&description=Gender:%20f=female,%20m=male
Successful results return:
SUCCESS: Create custom field 'gender'
Results
The Create Custom Field command outputs either a SUCCESS or FAILURE message.
SUCCESS
The Create Custom Field command success message returns the SUCCESS message and includes the name of the new Custom Field. The result format is:
SUCCESS: Create custom field '[fieldname]'
FAILURE
A Create Custom Field command will fail if a custom field with the same name already exists or invalid data is defined. The result format is:
FAILURE: [Reason]