getSubscribers

Description

Get a list of subscribers.



Params

Name Type Description
apiKey string API key previously generated.
offset integer Optional parameter to specify offset.
count integer Optional parameter to specify the number of records.
id integer Optional parameter to search by id.
email string Optional parameter to search by email.
name string Optional parameter to search by name.
groups array Optional parameter to search by groups. You can specify one or more ids. Example:

array( 1, 4 )
deleted boolean Optional parameter to search deleted subscribers.
activated boolean Optional parameter to search activated field.
sortField string Optional parameter to specify a search field.
sortOrder string Optional parameter to specify a sort order. Accepted values are ASC and DESC (default).
bounced boolean Optional parameter to only get subscribers that were marked as bounced.
startBouncedDate string Optional parameter to search by bounced date. It only works if bounced parameter is true.
endBouncedDate string Optional parameter to search by bounced date. It only works if bounced parameter is true.
spamReported boolean Optional parameter to only get subscribers that reported your messages as spam.
optedOut boolean Optional parameter to only get subscribers that opted out.
optedIn boolean Optional 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
                )

        )

)
Menu Title