« Back to Documentation Overview

campaignUnschedule – v1.1

 campaignUnschedule(string apikey, string cid)

Unschedule a campaign that is scheduled to be sent in the future

Section
Campaign Related
Parameters
apikey a valid API Key for your user account. Get by calling Get by visiting your API dashboard
cid the id of the campaign to unschedule
Returns
boolean true on success

Examples (2)

download example code

[1] mcapi_campaignUnschedule.php

  1. <?php
  2. /**
  3. This Example shows how to unschedule a campaign currently scheduled for delivery
  4. via the MCAPI class.
  5. **/
  6. require_once 'inc/MCAPI.class.php';
  7. require_once 'inc/config.inc.php'; //contains apikey
  8.  
  9. $api = new MCAPI($apikey);
  10.  
  11. $retval = $api->campaignUnschedule($campaignId);
  12.  
  13. if ($api->errorCode){
  14. echo "Unable to Unschedule Campaign!";
  15. echo "\n\tCode=".$api->errorCode;
  16. echo "\n\tMsg=".$api->errorMessage."\n";
  17. } else {
  18. echo "Campaign Unscheduled!\n";
  19. }
  20.  

[2] xml-rpc_campaignUnschedule.php

  1. <?php
  2. /**
  3. This Example shows how to use the XML-RPC service to Unschedule/stop a previously
  4. Scheduled Campaign so that it does not get sent out.
  5. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  6. **/
  7. require_once 'XML/RPC2/Client.php';
  8. require_once 'inc/config.inc.php';
  9.  
  10. try {
  11. $client = XML_RPC2_Client::create($apiUrl);
  12.  
  13. $result = $client->campaignUnschedule($apikey, $campaignId);
  14. echo "SUCCESS! \n";
  15. echo "Returned: ".$result;
  16. } catch (XML_RPC2_FaultException $e){
  17. echo "ERROR!!!!\n";
  18. echo $e->getFaultCode()." : ".$e->getFaultString()."\n";
  19. }
  20. echo "\n";
  21.  
  22.