countFiles

Counts the number of Files that match the search criteria.

countFiles

Counts the number of Files that match the search criteria.

Top ↑

Syntax

int countFiles( string api_key [, array search_criteria ] );

Parameters

api_key (string)

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

search_criteria (array - optional)

An array of search criteria that selects the Files to be counted. See searchFiles for a description of the values that can be searched on.

Return Value

The number of Files that match the search criteria.

Examples

The following example counts the number of Files with the name 'Koala' in your Account.

    $api = new Api($url, 'YOURAPIKEY');

    $search_criteria = array(
        array('basename', 'exactly', 'Koala')
    );

    $file = $api->invokeMethod('countFiles', $search_criteria);
{
    "id": 1,
    "method": "countFiles",
    "params": [
        "YOURAPIKEY",
        [
            ["basename", "exactly", "Koala"]
        ]
    ]
}
{
    "id": 1,
    "result": 1,
    "error": null
}

Error Codes

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

Code Error Description
311 Invalid Search Parameter Format search_criteria is not valid

See Also