Working with User-Defined Fields (UDF) and Types (UDT)
Last updated
Last updated
To remove a UDF or UDT value, submit a PUT request with the desired UDF or UDT omitted from the XML.
When submitting a PUT, it is critical to update all information. The submitted XML must include all the current UDFs and UDTs for the resource. If the field and type elements for a UDF and UDT are not included, the system removes those fields and types.
To update the UDF information for an item, the PUT request can add new UDF values and update or remove current UDF values. When working with UDTs, replace the current UDT with another UDT, or add or remove fields within the current UDT.
Update all UDFs and UDTs in a PUT
Even if the current user-defined values are not changing, include the current UDF and UDT values in the XML representation for a PUT request.
Data formatting of the UDF and UDT values is important when filtering a resource list with a query parameter. When using UDF or UDT values as a query parameter, all nonalphanumeric characters must be URL encoded.
UDFs and UDTs are presented as fields and types in the XML. The following example shows a representation of fields and types returned by a GET request for a sample:
XML resource representations do not render UDF values in the same format as views in the client user interface. The table later in this section compares images taken from the client user interface and the XML from an http GET.
The differences are intentional, to remove ambiguity and aid script writers when handling the data values.
The following table compares the values displayed by the user interface and the API for UDF data types.
Configured Data Type
API XML Response Element Type Name
Client Display
API Element Type Format
Single-line Text
String
Leading and trailing spaces rendered
Leading and trailing spaces rendered
Multi-line Text
Text
Leading and trailing spaces rendered
Leading and trailing spaces rendered
Numeric
Numeric
Set by display-precision ie, 4.5300 is displayed when display-precision equals 4
Simplest numeric form, removing trailing zeros ie, 4.53
Date
Date
mmmm dd, yyyy ie, Feb 15, 2019
yyyy-mm-dd ie, 2019-02-15
Trailing zeros are removed to support both integer and real numerics. Determine the significant digits by looking up the display-precision element of the /configuration/udfs/{udfid} resource.
When Date UDFs are expanded on the EPP command line, their format differs from the one used in the Clarity LIMS GUI and the REST API.