getSubscribers

Description

Get a list of subscribers.



Params

NameTypeDescription
apiKeystringAPI key previously generated.
offsetintegerOptional parameter to specify offset.
countintegerOptional parameter to specify the number of records.
idintegerOptional parameter to search by id.
emailstringOptional parameter to search by email.
namestringOptional parameter to search by name.
groupsarrayOptional parameter to search by groups. You can specify one or more ids. Example:

array( 1, 4 )
deletedbooleanOptional parameter to search deleted subscribers.
activatedbooleanOptional parameter to search activated field.
sortFieldstringOptional parameter to specify a search field.
sortOrderstringOptional parameter to specify a sort order. Accepted values are ASC and DESC (default).
bouncedbooleanOptional parameter to only get subscribers that were marked as bounced.
startBouncedDatestringOptional parameter to search by bounced date. It only works if bounced parameter is true.
endBouncedDatestringOptional parameter to search by bounced date. It only works if bounced parameter is true.
spamReportedbooleanOptional parameter to only get subscribers that reported your messages as spam.
optedOutbooleanOptional parameter to only get subscribers that opted out.
optedInbooleanOptional parameter to only get subscribers that opted in.

 

Returned data

Type: array

Description: Return array with subscribers data.

 

Json sample code

<?php

$curl = curl_init('https://your_url/ccm/admin/api/version/2/&type=json');

$postData = array(
    'function' => 'getSubscribers',
    'apiKey' => 'yourApiKey',
    'offset' => 0,
    'count' => 2
);

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$json = curl_exec($curl);
if ($json === false) {
    die('Request failed with error: '. curl_error($curl));
}

$result = json_decode($json);
if ($result->status == 0) {
    die('Bad status returned. Error: '. $result->error);
}

var_dump($result->data);

 

Result of API call

Array
(
    [0] => stdClass Object
        (
            [id] => 51
            [name] => 
            [email] => demo@mail.com
            [format] => html
            [encoding] => UTF-8
            [fields] => 
            [code] => 13344211
            [banned] => 0
            [activated] => 1
            [deleted] => 0
            [date] => 2012-02-14 12:31:53
            [updated_date] => 2012-02-14 12:31:53
            [fails] => 0
            [optout_date] => 
            [optin_date] => 
            [groups] => Array
                (
                    [0] => 1
                    [1] => 2
                )

        )

    [1] => stdClass Object
        (
            [id] => 50
            [name] => My name modified
            [email] => demo@mail.com
            [format] => html
            [encoding] => UTF-8
            [fields] => 
            [code] => 56481487
            [banned] => 0
            [activated] => 1
            [deleted] => 0
            [date] => 2012-02-14 11:50:54
            [updated_date] => 2012-02-14 12:31:53
            [fails] => 0
            [optout_date] => 
            [optin_date] => 
            [groups] => Array
                (
                    [0] => 1
                    [1] => 2
                )

        )

)