Home » updateCampaign

updateCampaign

Description

Updates the campaign with the given asset ID

Attributes

FieldTypeRequired
CampaignCampaignTrue

Campaign

FieldTypeDescriptionRequiredAccepted Value
idintA unique number to identify the campaign. falseThis is set by default when campaign is created.
namestringCampaign Namefalse
notesstringDisplays information pertaining to the campaign.false
statusstringStatus of the campaign. falseAccepted values are "A" for active and "I" inactive.
advertiserIdintId of the advertiser under which the campaign has to be created.false
createdByintShows who created the campaign. falseThis is set by default when campaign is created.
createdDatestringDate when the campaign was created. falseThis is set by default when campaign is created
modifiedByintShow who last modified the campaign .false This is set by default when campaign is modified.
modifiedDatestringShows the date when the campaign was last modified. falseThis is set by default when campaign is modified.
IoReferencestringCampaign IO number.false
startDatestringThe start date of the campaign. falseMinimum start date should be today-5 years
endDatestringThe end date of the campaign. false
levelintThe order or priority in which the ads will serve.false
exclusiveintA sponsorship campaign which has the highest priority. falseAccepted values are 0 for NORMAL or 1 for EXCLUSIVE. If the value is set to 1, then inventoryType must be set to "Premium".
categoryTypestringCompeting category type of the campaign. falseAccepted values are 0 for OFF, 1 for SELF and 2 for ON.
inventoryTypestringType of inventoryfalseAccepted values are "FOC" for Free of cost campaign, "Excess" for Excess campaigns and "Premium" for premium campaigns.
deliveryTypestringSpeedy or even or ASAP or Accelerated delivery. falseAccepted values are "E" for even , "S" for speedy , "A" for ASAP and "ACC" for Accelerated. Note: For accelerated delivery type, the per day limit type are not allowed. So following values should not be used for Limit Type field:- impressions per day,click per day,action per day,events per day.
revenueTypestringMetrics by which revenue is calculated. falseAccepted values are "CPM", "CPC", "CPA", "FOC" (Free of Cost), "HSE" (House ads), "HRD" (House redirects), and "BRT" (Barter).
limitTypeintSet Limit for the ad. falseAccepted values are 0 for Impressions, 1 for click, 2 for action, 3 for impressions per day, 4 for clicks per day and 5 for actions per day, 6 for events and 7 for events per day.
allocateTypestringDistributes the total number of impressions, clicks or actions to be served by channel or by ad.false Accepted values are "ad" for allocate by ad or "adchan" for allocate by channel.
limitAtstringDefines whether limit is at Ad level or at Campaign Level. falseAllowable values are 'AT_AD_LEVEL', 'AT_CAMPAIGN_LEVEL'. This field is required if AllocateType is set to 'ad'
allocationAtCampaignstringSets Limit on number of impressions, clicks or actions(selected Limit Type) to be delivered at Campaign Level. This field is required if limitAt is set to 'AT_CAMPAIGN_LEVEL'.false The value should be 'UNLIMITED' or greater than or equal to 10000 but less than 2000000000(2 billion).
distributeBystringSets distribution type for allocationAtCampaign. Allowable values are 'R' for Randomly and 'P' for Performance based.false
actionsAllocatedintSets a limit on the number of actions to be delivered.false
actionsDeliveredintNumber of actions recorded by the campaign.false
timezoneIdintTimezone in which your account is created in the system. falseThis value is set by default when the campaign is created.
costfloatThe cost set for the campaign.false
oldCostfloatCost value while creating the campaign.false
actionTypeintSpecifies type of actionfalseAccepted values are 0 for 'Tracking Off', 1 for 'Post Click', 2 for 'Post Impression', 3 for 'Post Impression + Post Click'.
ActionAction[ ]Actions for the campaignfalse
clicksAllocatedlongSets a limit on the number of clicks to be delivered.false
clicksDeliveredlongNumber of clicks recorded by the campaign.false
impressionsAllocatedlongAllocates impressions to a campaign - currently unavailable.false
impressionsDeliveredlongNumber of impressions recorded by the campaign.false
allocateByDayintImpressions, clicks or actions allocated on a daily basis.false
weightdoubleThe proportion in which ads within the same level should serve. This also helps to determine the priority of the ad.false
AutoOptimization autoOptimizationAutoOptimization properties for Campaign.false
updateFlagintUpdate flagfalseAccepted values are 1 for 'ON' or 0 for 'OFF'.
recomputeEarningsFlagintRecompute earnings flagfalseAccepted values are 1 for ON or 0 for OFF
frequencyCapEnabledBooleanDefines whether Frequency Capping is enabled at campaign level or not.falseAccepted values are true or false
campaignFrequencyCap CampaignFrequencyCapSets a frequency limit for the campaign.true if frequencyCapEnabled is set to true.
tagsTags[ ]Sets the tags for the campaignfalseMaximum no. of tags allowed are 5.
deleteTagsTags[ ]Deletes the tags for the campaignflaseMaximum no. of tags allowed are 5.

Samples

Java

import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import com.zedo.zapi.ZEDOAPIStub;

public class UpdateCampaignTest {

    public static void main(String[] args) {
        UpdateCampaignTest.updateCampaignTest();
    }

    private static void updateCampaignTest() {

        try {

            ZEDOAPIStub stub = new ZEDOAPIStub("http://api.zedo.com/v8/?wsdl&java");

            stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "user", "zedoapi"),     "example@example.com");
            stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "password", "zedoapi"),     "password");
            stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "network", "zedoapi"),  "525");
            stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(10 * 60 * 1000);

            ZEDOAPIStub.GetCampaign gc = new ZEDOAPIStub.GetCampaign();
            gc.setId(462321);
            Thread.sleep(1000);   
            ZEDOAPIStub.GetCampaignResponse gcr = stub.getCampaign(gc);
            ZEDOAPIStub.Campaign c = gcr.get_return();

            c.setActionsAllocated(0);
            c.setActionsDelivered(0);
            c.setAllocateByDay(0);
            c.setAllocateType("ad");
            c.setClicksAllocated(0);
            c.setClicksDelivered(0);
            c.setCost(0);
            c.setEndDate("2008-11-11");
            c.setImpressionsAllocated(0);
            c.setImpressionsDelivered(0);
            c.setLevel(12);
            c.setLimitType(0);
            c.setName("updateZedo");
            c.setNotes("forTest");
            c.setOldCost(0);
            c.setRecomputeEarningsFlag(0);
            c.setStartDate("2007-12-12");
            c.setStatus("A");
            c.setLimitAt("AT_CAMPAIGN_LEVEL");
            c.setAllocationAtCampaign("12000000");
            c.setDistributeBy("R");
            c.setTimezoneId(0);
            c.setUpdateFlag(0);
            c.setWeight(45);

            ZEDOAPIStub.Action[] action1 = new ZEDOAPIStub.Action[2];
            action1[0] = new ZEDOAPIStub.Action();
            action1[0].setItemNumber(1);
            action1[0].setMaxLifeTime(13);
            action1[0].setName("myNameZedo1");
            action1[0].setRate(0.0);
            action1[0].setStatus("A");
            action1[0].setUrl("http://www.myTest.com");
            action1[1] = new ZEDOAPIStub.Action();
            action1[1].setItemNumber(5);
            action1[1].setMaxLifeTime(14);
            action1[1].setName("myNameZedo2");
            action1[1].setRate(0.0);
            action1[1].setStatus("A");
            action1[1].setUrl("http://www.myTest.com");
            c.setActions(action1);

ZEDOAPIStub.Tag[] tag1= new ZEDOAPIStub.Tag[2];
 tag1[0] = new ZEDOAPIStub.Tag();
 tag1[0].setName("tag1");
 tag1[0].setValue("value1");
tag1[1]= new ZEDOAPIStub.Tag();
tag1[1].setName("tag5");
tag1[1].setValue("value5");
 
 c.setTags(tag1);
 
 ZEDOAPIStub.Tag[] tag= new ZEDOAPIStub.Tag[1];
 tag[0] = new ZEDOAPIStub.Tag();
 tag[0].setName("tag6");
 tag[0].setValue("value6");
 
 c.setDeleteTags(tag);
            ZEDOAPIStub.UpdateCampaign uc = new ZEDOAPIStub.UpdateCampaign();
            uc.setCmp(c);
            Thread.sleep(1000);
            stub.updateCampaign(uc);

            System.out.println("UPDATE_CAMPAIGN COMPLETE!");
            System.out.println(uc.getCmp().getName()+" " +uc.getCmp().getId());

        } catch (Exception e) {
            System.err.println("ERROR: UPDATE_CAMPAIGN FAILED!");
            System.err.println("Exception: " + e.getMessage());
            if (e instanceof AxisFault) {
                AxisFault af = (AxisFault) e;
                System.err.println("AxisFault's detail: " + af.getDetail());
                af.printStackTrace();
            } else {
                e.printStackTrace();
            }
        }
    }
}

PHP

 include_once './zlib/ZEDOAPI.php';
        
        /**
         *Create Client Stub
         */
        $config = Array();
        $config['location'] = 'http://api.zedo.com/v8/?wsdl&php';       //URL of the SOAP server to send the request to
        $config['exceptions'] = true;                                                                                                   //Enable Exception Handling
        
        $stub = new ZEDOAPI($config);
        
        $header = Array();
        $header[0] = new SoapHeader('http://api.zedo.com','user', 'example@example.com');
        $header[1] = new SoapHeader('http://api.zedo.com','password', 'password');
        $header[2] = new SoapHeader('http://api.zedo.com','network','525');
        $header[3] = new SoapHeader('http://api.zedo.com','callinfo','zapiCall');
        
        $stub->__setSoapHeaders($header);
        
        /**
         *Define Call Parameters 
         */
        $campaign_id = 1349793;
        $param = new getCampaign($campaign_id);
        
        /**
         *Execute API Call 
         */
        try {
        $response = $stub->getCampaign($param);
        }catch (SoapFault $ex) {
           var_dump($ex->faultcode, $ex->faultstring, $ex->detail);
                echo "GET CAMPAIGN FAILED\n";
                die();
        }
        
        /**
         * Response
         */
        $tmp = new getCampaignResponse($response);
        $tmp = $tmp->return;
        $campaign = $tmp->return;
        
        /**
         * Edit Campaign
         */
        $campaign->startDate="2013-01-01";
        $campaign->endDate="2013-01-02";
         $tag=Array();
 $tag[0]=new Tag();
 $tag[0]->name="tag5";
 $tag[0]->value="value5";
 $campaign->tags=$tag;

 $tag1= Array();
 $tag1[0]=new Tag();
 $tag1[0]->name="tag6";
 $tag1[0]->value="value6";
 $campaign->deleteTags=$tag1;
        /**
         * Update Campaign
         */
        print_r($campaign);
        $updateCampaign = new updateCampaign($campaign);
        try {
        $response = $stub->updateCampaign($updateCampaign);
        }catch (SoapFault $ex) {
            var_dump($ex->faultcode, $ex->faultstring, $ex->detail);

                echo "UPDATE CAMPAIGN FAILED\n";
                die();
        }

SOAP

Request

POST /axis2/services/ZEDOAPI?wsdl HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="urn:updateCampaign"
User-Agent: Axis2
Host: dev08.juhu.zedo.com:2000
Transfer-Encoding: chunked
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<zedoapi:user xmlns:zedoapi="http://api.zedo.com">example@example.com</zedoapi:user>
<zedoapi:password xmlns:zedoapi="http://api.zedo.com">password</zedoapi:password>
<zedoapi:network xmlns:zedoapi="http://api.zedo.com">525</zedoapi:network>
</soapenv:Header>
<soapenv:Body>
<ns5:updateCampaign xmlns:ns5="http://zapi.zedo.com">
<ns5:cmp>
<ns1:actionType xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:actionType>
<ns1:actionsAllocated xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:actionsAllocated>
<ns1:actionsDelivered xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:actionsDelivered>
<ns1:advertiserId xmlns:ns1="http://client.api.zedo.com/xsd">1173688</ns1:advertiserId>
<ns1:allocateByDay xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:allocateByDay>
<ns1:allocateType xmlns:ns1="http://client.api.zedo.com/xsd">ad</ns1:allocateType>
<ns1:autoOptimization xmlns:ns1="http://client.api.zedo.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" />
<ns1:categoryType xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:categoryType>
<ns1:clicksAllocated xmlns:ns1="http://client.api.zedo.com/xsd">1000</ns1:clicksAllocated>
<ns1:clicksDelivered xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:clicksDelivered>
<ns1:cost xmlns:ns1="http://client.api.zedo.com/xsd">1.0</ns1:cost>
<ns1:createdBy xmlns:ns1="http://client.api.zedo.com/xsd">41107</ns1:createdBy>
<ns1:createdDate xmlns:ns1="http://client.api.zedo.com/xsd">2016-01-20 23:22:11</ns1:createdDate>
<ns1:deliveryType xmlns:ns1="http://client.api.zedo.com/xsd">S</ns1:deliveryType>
<ns1:endDate xmlns:ns1="http://client.api.zedo.com/xsd">2016-05-05 23:59:59</ns1:endDate>
<ns1:endTime xmlns:ns1="http://client.api.zedo.com/xsd">23:59</ns1:endTime>
<ns1:eventsDelivered xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:eventsDelivered>
<ns1:exclusive xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:exclusive>
<ns1:id xmlns:ns1="http://client.api.zedo.com/xsd">1173696</ns1:id>
<ns1:impressionsAllocated xmlns:ns1="http://client.api.zedo.com/xsd">1000</ns1:impressionsAllocated>
<ns1:impressionsDelivered xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:impressionsDelivered>
<ns1:inventoryType xmlns:ns1="http://client.api.zedo.com/xsd">Premium</ns1:inventoryType>
<ns1:ioReference xmlns:ns1="http://client.api.zedo.com/xsd">
</ns1:ioReference>
<ns1:level xmlns:ns1="http://client.api.zedo.com/xsd">60</ns1:level>
<ns1:limitAt xmlns:ns1="http://client.api.zedo.com/xsd">AT_AD_LEVEL</ns1:limitAt>
<ns1:limitType xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:limitType>
<ns1:modifiedBy xmlns:ns1="http://client.api.zedo.com/xsd">41107</ns1:modifiedBy>
<ns1:modifiedDate xmlns:ns1="http://client.api.zedo.com/xsd">2016-01-21 01:09:11</ns1:modifiedDate>
<ns1:name xmlns:ns1="http://client.api.zedo.com/xsd">new_test123</ns1:name>
<ns1:notes xmlns:ns1="http://client.api.zedo.com/xsd">
</ns1:notes>
<ns1:oldCost xmlns:ns1="http://client.api.zedo.com/xsd">0.0</ns1:oldCost>
<ns1:recomputeEarningsFlag xmlns:ns1="http://client.api.zedo.com/xsd">0</ns1:recomputeEarningsFlag>
<ns1:revenueType xmlns:ns1="http://client.api.zedo.com/xsd">CPA</ns1:revenueType>
<ns1:startDate xmlns:ns1="http://client.api.zedo.com/xsd">2015-07-29 18:00:00</ns1:startDate>
<ns1:startTime xmlns:ns1="http://client.api.zedo.com/xsd">00:00</ns1:startTime>
<ns1:status xmlns:ns1="http://client.api.zedo.com/xsd">A</ns1:status> <ax24:deleteTags type="com.zedo.api.client.Tag">
 <ax24:name>tag5</ax24:name>
 <ax24:value>value5</ax24:value>
 </ax24:deleteTags>
 <ax24:tags type="com.zedo.api.client.Tag">
 <ax24:name>tag6</ax24:name>
 <ax24:value>value6</ax24:value>
 </ax24:tags>
<ns1:timezoneId xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:timezoneId> <ns1:updateFlag xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:updateFlag> <ns1:weight xmlns:ns1="http://client.api.zedo.com/xsd">100.0</ns1:weight> </ns5:cmp> </ns5:updateCampaign> </soapenv:Body> </soapenv:Envelope> 

Response

HTTP/1.1 200 OK
Date: Thu, 21 Jan 2016 09:09:41 GMT
Server: Simple-Server/1.1
Transfer-Encoding: chunked
Content-Type: application/soap+xml; charset=UTF-8; action="urn:updateCampaignResponse"
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:updateCampaignResponse xmlns:ns="http://zapi.zedo.com">
<ns:return>0</ns:return>
</ns:updateCampaignResponse>
</soapenv:Body>
</soapenv:Envelope>