JSON API » fields » fields/update
Updates an existing custom field.
Input parameters
Requires authentication and the system role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
id | Integer | ID of custom field to update. | Yes | |
customer | Integer | ID of customer to show field to. 0 for all customers. | No | Current value. |
default_value | String | Default value. See note below. | No | Current value. |
description | String | Description. | No | Current value. |
help | String | Help text shown to users. | No | Current value. |
hidden | Integer | 1 if hidden from users, 0 if shown. | No | Current value. |
name | String | Name of field. Not shown to users. | No | Current value. |
object | String | Object field applies to. "customer" or "phone". | No | Current value. |
placeholder | String | Placeholder text shown to users. Only used for "text" type. | No | Current value. |
rank | Integer | Order to show custom field in. 1 for first, 100 for last. | No | Current value. |
title | String | Name as shown to users. | No | Current value. |
type | String | Type of field. "allowed" for set of allowed values. "boolean" for yes/no. "text" for text. See note below. | No | Current value. |
validate | String | A regular expression used to validate the user's input. Empty string for none. | No | Current value. |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
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
Code | Description |
---|---|
201 | Input passed validation. Only returned if validation=1. |
204 | Success. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
404 | The 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
Version | Changes |
---|---|
4.0 | Function added. |