getFieldById

Returns details for a specific Field in a List.

getFieldById

Returns details for a specific Field in a List.

Top ↑

Syntax

array getFieldById( string api_key, int list_id, int field_id );

Parameters

api_key (string)

Key required to access the API. See Getting Started for more information.

list_id (int)

The ID of the List containing the Field.

field_id (int)

The ID of the Field to retrieve.

Return Value

Returns an array containing a single associative array of Field details. See searchFields for a description of the values returned.

Examples

The following code gets Field 2345678 and returns its details.

$list_id = 1234567;     // See searchLists()
$field_id = 2345678;

$api = new Api($url, 'YOURAPIKEY');
$fields = $api->invokeMethod('getFieldById', $list_id, $field_id);

// result is an array with a single associative array of Field details
print "Retrieved details for ". $fields[0]['name'] ."\n";
{
    "id": 1,
    "method": "getFieldById",
    "params": [
        "YOURAPIKEY",
        1234567,
        2345678
    ]
}
{
    "id":1,"result":[
        {
            "id": 2345678,
            "list_id": 1234567,
            "name": "Email",
            "type": "text",
            "is_mandatory" :true,
            "allow_update" :true,
            "show_in_form": 1,
            "length": 80,
            "size": 30,
            "row_size": 4,
            "default_value": "",
            "values_array": "",
            "defaults_array": "",
            "dont_store_default": 0,
            "allowed_file_types": "",
            "file_folder_id": 0,
            "address_type": "email",
            "time_format": "",
            "date_validation": "",
            "display_order": 2
        }
    ],
    "error":null
}

Error Codes

This method may return the following error codes in addition to the standard error codes:

Code Error Description
303 Unable to Load List list_id is not a valid List
305 Unable to Load Field field_id is not a valid Field in the List

See Also