JSON API » fields » fields/update

Updates an existing custom field.

Input parameters

Requires authentication and the system role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
idIntegerID of custom field to update.Yes
customerIntegerID of customer to show field to. 0 for all customers.NoCurrent value.
default_valueStringDefault value. See note below.NoCurrent value.
descriptionStringDescription.NoCurrent value.
helpStringHelp text shown to users.NoCurrent value.
hiddenInteger1 if hidden from users, 0 if shown.NoCurrent value.
nameStringName of field. Not shown to users.NoCurrent value.
objectStringObject field applies to. "customer" or "phone".NoCurrent value.
placeholderStringPlaceholder text shown to users. Only used for "text" type.NoCurrent value.
rankIntegerOrder to show custom field in. 1 for first, 100 for last.NoCurrent value.
titleStringName as shown to users.NoCurrent value.
typeStringType of field. "allowed" for set of allowed values. "boolean" for yes/no. "text" for text. See note below.NoCurrent value.
validateStringA regular expression used to validate the user's input. Empty string for none.NoCurrent value.
validationInteger1 to validate input then return, 0 for full action.No0

If changing the type from "boolean" or "text" to "allowed", the default value is set to empty string. You should then use fields/allowed/create to add allowed values, then make another call to fields/update to set the default value.

Responses

CodeDescription
201Input passed validation. Only returned if validation=1.
204Success.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
404The custom field does not exist.

Data returned

No data is returned.

Example: Changing the title

http://enswitch.example.com/api/json/fields/update/?auth_username=user;auth_password=password;id=123;title=Example+field

{ "responses":[ { "code":"204", "key":"", "message":"OK" } ] }

Change history

VersionChanges
4.0Function added.