Vision 6

countPreviousUnsubscribers

Counts the number of previous unsubscribers in the Unsubscriber List that match the search criteria.

countPreviousUnsubscribers

Counts the number of previous unsubscribers in the Unsubscriber List that match the search criteria.

Top ↑

Syntax

int countPreviousUnsubscribers(
    string api_key,
  [ int list_id,
    array criteria ] 
);

Parameters

api_key (string)

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

list_id (int - optional)

A List ID. Set to 0 to count the number of previous unsubscribers from all Lists (default).

criteria (array - optional)

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

Return Value

The number of previous unsubscribers in the Unsubscriber List that match the search criteria. If list_id is 0, the number of previous unsubscribers from all Lists that match the search criteria are returned.

Examples

This example counts the number of previous unsubscribers in list 123456 that have an email address ending with .com.

PHP

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

$list_id = 123456;

$criteria = array(
    array(
        'field' => 'address_type',
        'modifier' => 'exactly',
        'value' => 'email'
    ),
    array(
        'field' => 'address',
        'modifier' => 'contains',
        'value' => 'com'
    )
);

$result = $api->invokeMethod('countPreviousUnsubscribers', $list_id, $criteria);

JSON Request

{
    "id": 1,
    "method": "countPreviousUnsubscribers",
    "params": [
        "YOURAPIKEY",
        123456,
        [
            {
                "field": "address_type",
                "modifier": "exactly",
                "value": "email"
            },
            {
                "field": "address",
                "modifier": "contains",
                "value": "com"
            }
        ]
    ]
}

JSON Response

{
    "id": 1,
    "result": 6,
    "error": null
}

Error Codes

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

Code Error Description
310 Invalid Method Parameters One or more of the parameters are invalid.
311 Invalid Search Parameter Format The search criteria format is invalid.

See Also