Create or Update Custom Field
To create or update a custom field, use the /rest/1/custom-field
endpoint. You must provide the request parameters.
Request Parameters
req (body): Required. To create a custom field, specify name, type, and other parameters of the field. To update a custom field, add its ID to the parameters.
customName (string): Required. Specify the custom field name.
id (string): Required when you want to update a certain custom field. When you want to create a custom field, id is not required.
type (string): Required. Select from these types - 'picker', 'dropdown', 'textfield', and 'link'.
dropdownquery (string): Required if you specify the type as 'dropdown'. Enter the dropdown value(s). Values cannot contain '&' character.
pickerquery (sting): Required if you specify the type as 'picker'. Enter the picker query.
canBeLoaded (string): Optional. You can enable the change of the custom field value only by metadata loader by checking the Can Be Loaded box. When checked, you can't change values of this custom field. When not specified, the default value is 'false'. You can use this parameter for any custom field type.
defaultText (string): Optional. Specify the default text for the text custom field.
visibleEmpty (string): Optional. You can specify if the custom field will be visible when empty by checking the Visible when empty box. When checked, the custom field will be visible when empty. When not specified, the default value is 'false'. You can use this parameter for any custom field type.
isInlineEditable (string): Optional. You can specify if the field should be inline editable. If checked, you can assign a value to the custom field without editing the asset. When not specified, the default value is 'false'. You can use this parameter for picker custom field type.
multiple (string): Optional. You can specify if the Picker custom field should have multiple selections. If checked, you can assign multiple items to the asset. When not specified, the default value is 'false'. You can use this parameter for picker custom field type.
For more information about custom fields, visit the Asset Configuration help page.
Create Text Custom Field Example
{ "customName":"Text Some Custom Field Name", "type":"textfield", "defaultText":"Some Default Text", "canBeLoaded":"false", "visibleEmpty":"true" }
Create Dropdown Custom Field Example
{ "customName":"Some drop Custom Field Name", "type":"dropdown", "defaultText":"Some Default Text", "canBeLoaded":"false", "visibleEmpty":"false", "dropdownquery":"line1;line2;line3" }
Create Picker Custom Field Example
{ "customName":"Some picker1", "type":"picker", "defaultText":"Some Default Text", "canBeLoaded":"false", "visibleEmpty":"true", "isInlineEditable": "false", "multiple":"true", "pickerquery":"type:term" }
Update Text Custom Field Example
{ "id": "t1822651913", "customName":"Text Some Custom Field Name", "type":"textfield", "defaultText":"Some Default Text", "canBeLoaded":"false", "visibleEmpty":"true" }
Curl Request Example
curl -X POST "http://localhost:8080/rest/1/custom-field" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"customName\":\"Text Some Custom Field Name\",\"type\":\"textfield\",\"defaultText\":\"Some Default Text\",\"canBeLoaded\":\"false\",\"visibleEmpty\":\"true\"}"
Response Example
Response Body
{ "data": "t270475346", "isSuccess": true }
Response Headers
cache-control: no-cache, no-store, max-age=0, must-revalidate connection: Keep-Alive content-length: 38 content-type: application/json;charset=ISO-8859-1 date: Fri, 21 Aug 2020 08:25:10 GMT expires: 0 keep-alive: timeout=5, max=100 pragma: no-cache server: Apache/2.4.10 (Debian) x-content-type-options: nosniff x-frame-options: DENY x-xss-protection: 1; mode=block