updateSubscriber

Description

Update subscriber data.



Params

NameTypeDescription
apiKeystringAPI key previously generated.
idintegerId of the subscriber that you want to update.
emailstringEmail.
namestringName.
groupsarrayArray with the IDs of the groups that this subscriber belongs. Example for groups 10 and 14:

array( 10, 14 )
customFieldsarrayOptional parameter for custom fields. Use f_FieldId as key. Example with two fields:

array( 'f_1' => 'Madrid', 'f_2' => '5555-5555' )
activatedbooleanOptional parameter to activate/inactive subscriber
sendAutorespondersbooleanOptional parameter to specify if immediate autoresponders should be sent to this subscriber after this update.

 

Returned data

Type: boolean

Description: Return true if subscriber was updated.

 

Json sample code

<?php

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

$postData = array(
    'function' => 'updateSubscriber',
    'apiKey' => 'apiKey',
    'id' => 5,
    'email' => 'user@example.org',
    'name' => 'My name',
    'groups' => array(
        1,
        3,
        5
    )
);

$post = http_build_query($postData);

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
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

bool(true)