API reference: Data fields documents the function signatures, parameters, return values, and error behavior of the Elaine HTTP API.
Function availability depends on the Elaine release and enabled features. Authenticate HTTP requests with an Elaine-issued Bearer JWT.
Function overview
| boolean | api_datafieldChangeList ( int $f_id , array $names , array $values ) |
| Modifies the specified list data field with the transferred values. |
| integer | api_datafieldCreateList ( string $type , string $label , string $location , array $set_labels , array $set_values , bool $hide = false , int $group_id , bool $asynchronous = true , string $description = '' ) |
| Creates a new data field of the type 'select' or 'multiselect'. |
| integer | api_datafieldCreateSingle ( string $type , string $label , string $location = 'dataset' , bool $hide = false , int $length = 255 , int $group_id , bool $asynchronous = true , string $description = '' ) |
| Creates a new data field of the type 'text', 'textfield', 'int', 'date', 'checkbox'. |
| boolean | api_datafieldDelete ( int $f_id ) |
| Deletes the given data field. |
| array|integer | api_getDatafieldOptions ( int $f_id ) |
| Identifies the value range of a data field (array with label and value). |
| array | api_getDatafields ( int $group ) |
| Delivers a list of all data fields existing in the tenant. |
Functions
api_datafieldChangeList
boolean api_datafieldChangeList( int $f_id , array $names , array $values )
Modifies the specified list data field with the transferred values. It is possible to amend the data field with further parameters, as well as remove the existing data field or create a new structure of the list-based data field. The function returns a result immediately, as the data field is created in a background process.
Note: Existing content of this data field can be damaged or deleted by retrieval, in particular when decreasing the value range.
Parameters
| int | $f_id | Datafield ID |
| array | $names | List of labels for the list to create |
| array | $values | List of values for the list to create |
Return Value
| boolean | Success or error code |
api_datafieldCreateList
integer api_datafieldCreateList( string $type , string $label , string $location , array $set_labels , array $set_values , bool $hide = false , int $group_id , bool $asynchronous = true , string $description = '' )
Creates a new data field of the type 'select' or 'multiselect'. For 'select' type must be 'enum' and for 'multiselect' type must be 'set'. Two arrays with the value range and labels of the individual values must be transferred. The function immediately returns a result, as the data field is created in a background process. More details on the parameters $group and $asynchronous can be found in the description of api_datafieldCreateSingle().
Parameters
| string | $type | Type of datafield to create. For selects $type is "enum" and for multiselects $tpye is "set" |
| string | $label | Label of datafield create |
| string | $location | Location to save datafield (client or dataset table) |
| array | $set_labels | List of labels for the list to create |
| array | $set_values | List of values for the list to create |
| bool | $hide = false | Datafield in frontend forms [optional] |
| int | $group_id | ID of group [optional] (only needed when location == 'group') |
| bool | $asynchronous = true | Wether to run the creation asynchronously (default true) |
| string | $description = '' | Description of datafield usage [optional] |
Return Value
api_datafieldCreateSingle
integer api_datafieldCreateSingle( string $type , string $label , string $location = 'dataset' , bool $hide = false , int $length = 255 , int $group_id , bool $asynchronous = true , string $description = '' )
Creates a new data field of the type 'text', 'textfield', 'int', 'date', 'checkbox'. Fields of the type 'text' require a length specification (max. 255 characters). This function immediately returns a result, as the data field is created in a background process.
If $group is included, this data field is created as a group data field for this group. If $asynchronous is set to true, the data field will be created in the background. In this case, the server answers faster, however, the creation of the data field is asynchronous. If false is set, the server will wait with its answer until the data field is created.
Note: Data fields should not be created asynchronously, if they are created within a loop during the import, as the subsequent creation of content for this data field may cause errors.
Parameters
| string | $type | Type of datafield to create |
| string | $label | Label of datafield create (max. 62 symbols) |
| string | $location = 'dataset' | Location to save datafield (client or dataset table) |
| bool | $hide = false | Datafield in frontend forms [optional] |
| int | $length = 255 | Length of textfield [optional] |
| int | $group_id | ID of group [optional] (only needed when location == 'group') |
| bool | $asynchronous = true | Wether to run the creation asynchronously (default true) |
| string | $description = '' | Description of datafield usage [optional] |
Return Value
api_datafieldDelete
boolean api_datafieldDelete( int $f_id )
Deletes the given data field.
Parameters
Return Value
| boolean | Success or error code |
api_getDatafieldOptions
array|integer api_getDatafieldOptions( int $f_id )
Identifies the value range of a data field (array with label and value).
Parameters
Return Value
| array|integer | Array with labels and values or error code |
api_getDatafields
array api_getDatafields( int $group )
Delivers a list of all data fields existing in the tenant. The following information is transmitted: ID, name, type, hidden, length, location, system field. If a $group is included, only group data fields of this group will be transferred.
Parameters
Return Value