Back to Documentation Overview
campaignUpdate
public static campaignUpdate(string apikey, string cid, string name, mixed value)
Update just about any setting for a campaign that has not been sent. See campaignCreate() for details
Caveats:
- If you set list_id, all segmentation options will be deleted and must be re-added.
- If you set template_id, you need to follow that up by setting it's 'content'
- If you set segment_opts, you should have tested your options against campaignSegmentTest() as campaignUpdate() will not allow you to set a segment that includes no members.
- Section:
- Campaign Related
- Parameters:
apikey a valid API Key for your user account. Get by calling login() cid the Campaign Id to update name the parameter name ( see campaignCreate() ) value an appropriate value for the parameter ( see campaignCreate() ) - Returns:
- boolean - true if the update succeeds, otherwise an error will be thrown
- <?php
- /**
- This Example shows how to Update a regular Campaign via the MCAPI class.
- **/
- require_once 'inc/MCAPI.class.php';
- require_once 'inc/config.inc.php'; //contains apikey
- $field = "title";
- $value = "My New Title";
- $retval = $api->campaignUpdate($campaignId, $field, $value);
- if ($api->errorCode){
- } else {
- }
- <?php
- /**
- This Example shows how to Update an A/B Split Campaign via the MCAPI class.
- **/
- require_once 'inc/MCAPI.class.php';
- require_once 'inc/config.inc.php'; //contains apikey
- $field = "absplit";
- $value = "My New Title";
- $ab_opts['split_test'] = 'from_name';
- $ab_opts['pick_winner'] = 'manual';
- $ab_opts['from_name_a'] = 'David Gilmour';
- $ab_opts['from_email_a'] = 'david@example.org';
- $ab_opts['from_name_b'] = 'Roger Waters';
- $ab_opts['from_email_b'] = 'roger@example.org';
- $retval = $api->campaignUpdate($campaignId, $field, $ab_opts);
- if ($api->errorCode){
- } else {
- }
- <?php
- /**
- This Example shows how to update various parameters of a Campaign using XML-RPC.
- Note that we are using the PEAR XML-RPC client and recommend others do as well.
- **/
- require_once 'XML/RPC2/Client.php';
- require_once 'inc/config.inc.php';
- try {
- $field = "title";
- $value = "My New Title";
- $result = $client->campaignUpdate($apikey, $campaignId, $field, $value);
- } catch (XML_RPC2_FaultException $e){
- }
- <?php
- /**
- This Example shows how to update an AB Split Campaign using XML-RPC.
- Note that we are using the PEAR XML-RPC client and recommend others do as well.
- **/
- require_once 'XML/RPC2/Client.php';
- require_once 'inc/config.inc.php';
- try {
- $field = "absplit";
- $value = "My New Title";
- $ab_opts['split_test'] = 'from_name';
- $ab_opts['pick_winner'] = 'manual';
- $ab_opts['from_name_a'] = 'David Gilmour';
- $ab_opts['from_email_a'] = 'david@example.org';
- $ab_opts['from_name_b'] = 'Roger Waters';
- $ab_opts['from_email_b'] = 'roger@example.org';
- $result = $client->campaignUpdate($apikey, $campaignId, $field, $ab_opts);
- } catch (XML_RPC2_FaultException $e){
- }
Examples (4)
download example code[1] mcapi_campaignUpdate.php
[2] mcapi_campaignUpdateAB.php
[3] xml-rpc_campaignUpdate.php
[4] xml-rpc_campaignUpdateAB.php
|
Add New Note
User Contributed Notes for
campaignUpdate |
|---|
| No notes, yet... Will you be the first?? |