Service: ImportPreferenceSubscriptions

Create multiple subscription for one or more email addresses for one or more preferences

Service Details

SOAP Action: ImportPreferenceSubscriptions
SOAP Return Object: ImportPreferenceSubscriptionsResp

Input

The following table describes the parameters used for calling the ImportPreferenceSubscriptions service.

Table: instance of ImportPreferenceSubscriptionsReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
preferenceSubscriptionTypeItems Y Array of PreferenceSubscriptionType An array of prefereTypeItems

Output

The following table describes the parameters returned from the ImportPreferenceSubscriptions service.

Table: instance of ImportPreferenceSubscriptionsResp

Parameter Mandatory Type Description
header / APIResponseHeader Header containing authentication information
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error

Table: response codes of ImportPreferenceSubscriptionsResp.

0 No error
220 Authentication error, see header object for detailed information

Example

This example shows you how to create 3 email addresses / preference subscriptions

<?php

$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

$importPreferenceSubscriptionsReq->header = $header;
$importPreferenceSubscriptionsReq->preferenceSubscriptionTypeItems = [];

$subscriptionType = new stdClass();
$subscriptionType->preferenceId = 33;
$subscriptionType->emailAddressFlexmailId = 257;

$importPreferenceSubscriptionsReq->preferenceSubscriptionTypeItems[] = $subscriptionType;

$subscriptionType = new stdClass();
$subscriptionType->preferenceId = 33;
$subscriptionType->emailAddressFlexmailId = 258;

$importPreferenceSubscriptionsReq->preferenceSubscriptionTypeItems[] = $subscriptionType;

$subscriptionType = new stdClass();
$subscriptionType->preferenceId = 34;
$subscriptionType->emailAddressFlexmailId = 257;

$importPreferenceSubscriptionsReq->preferenceSubscriptionTypeItems[] = $subscriptionType;

$importPreferenceSubscriptionsResp = $SoapClient->__soapCall("ImportPreferenceSubscriptions", array($importPreferenceSubscriptionsReq));

foreach ($ImportEmailAddressesResp->importEmailAddressRespTypeItems as $item) {
    if ($item->errorCode == 0) {
        echo "Preference: " . $item->preferenceId . ", emailAddressId: " .  $item->emailAddressFlexmailId . "imported succesfull <br>";
    } else {
        echo "Preference: " . $item->preferenceId . ", emailAddressId: " .  $item->emailAddressFlexmailId . " error: " . $item->errorMessage . "<br>";
    }
}


?>