Service: GetCampaigns

The GetCampaigns service allows you to retrieve a list of all campaigns within Flexmail

Service Details

SOAP Action: GetCampaigns
SOAP Return Object: GetCampaignsResp

Input

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

Table: instance of GetCampaignsReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
type / String Filter results by type: Campaign, TestCampaign or Workflow
campaignId / Integer Campaign Id

Output

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

Table: instance of GetCampaignsResp

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)

Table: response codes of GetCampaignsResp.

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

Example

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;
}
?>