clearList

Deletes all Contacts in a List.

clearList

Deletes all Contacts in a List.

Top ↑

Syntax

bool clearList( string api_key, int list_id );

Parameters

api_key (string)

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

list_id (int)

The ID of the List to clear.

Return Value

Returns true on success.

Examples

In the following example, all data is removed from List 1234567.

$list_id = 1234567;     // can be obtained using searchLists()

$api = new Api($url, 'YOURAPIKEY');
$api->invokeMethod('clearList', $list_id);
{
    "id": 1,
    "method": "clearList",
    "params": [
        "YOURAPIKEY",
        1234567
    ]
}
{
    "id": 1,
    "result": true,
    "error": null
}

Remarks

This method will also delete all associated Contact Notes.

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.
313 Cannot Edit Account Lists list_id is an Account List. Contacts in the Account List cannot be deleted.
302 Undefined Error: Unable to clear list An internal error occurred while the method was trying to delete all Contacts in the List.

See Also