The GetCampaigns service allows you to retrieve a list of all campaigns within Flexmail
SOAP Action: GetCampaigns
SOAP Return Object: GetCampaignsResp
The following table describes the parameters used for calling the GetCampaigns service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
type | / | String | Filter results by type: Campaign, TestCampaign or Workflow |
campaignId | / | Integer | Campaign Id |
The following table describes the parameters returned from the GetCampaigns 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 |
campaignTypeItems | / | Array of CampaignType | Array of all campaigns |
campaignRecipients | / | Integer | The number of recipients (only for not sent campaigns) |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
This example shows you how to get a list of all campaigns within flexmail.
<?php $header->userId = USER_ID; $header->userToken = USER_TOKEN; $getCampaignsReq->header = $header; $getCampaignsResp = $SoapClient->__soapCall("GetCampaigns", array( $getCampaignsReq )); if ($getCampaignsResp->errorCode == 0) { foreach ($getCampaignsResp->campaignTypeItems as $campaignType) { echo $campaignType->campaignId . " - " . $campaignType->campaignName; } } else { echo "Get campaigns failed: " . $getCampaignsResp->errorMessage; } ?>