Note: Groups are called Interest Labels in the GUI
The CreateGroupSubscription service allows you to create a new group subscription within Flexmail, add an email address to a group. The ID of the newly created GroupSubscription will be returned to you.
SOAP Action: CreateGroupSubscription
SOAP Return Object: CreateGroupSubscriptionResp
The following table describes the parameters used for calling the CreateGroupSubscription service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
groupSubscriptionType | Y | GroupSubscriptionType | Group subscription to create |
The following table describes the parameters returned from the CreateGroupSubscription service.
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 |
groupSubscriptionId | / | Integer | Id of the new group subscription |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | Invalid flexmail id |
222 | Invalid reference id / mailing list id / value combination |
223 | Group subscription already exists |
224 | Internal error |
This example shows you the creation of a new GroupSubscription within Flexmail, email address with id 2546777 will be added to the group with id 657.
<?php $header->userId = USER_ID; $header->userToken = USER_TOKEN; $createGroupSubscriptionReq->header = $header; $createGroupSubscriptionReq->groupSubscriptionType->groupId = 657; $createGroupSubscriptionReq->groupSubscriptionType->emailAddressFlexmailId = 2546777; $createGroupSubscriptionResp = $SoapClient->__soapCall("CreateGroupSubscription", array($createGroupSubscriptionReq)); if ($createGroupSubscriptionResp->errorCode == 0) { echo "GroupSubscription created: " . $createGroupSubscriptionResp->groupSubscriptionId; } else { echo "Group subscription failed: " . $createGroupSubscriptionResp->errorMessage; } ?>