Home » createAdvertiser

createAdvertiser

Description

 

Creates a new Advertiser.

To create an advertiser set the required values in the Advertiser object. This Advertiser object can be set in the Adv field of the createAdvertiser call.

Attributes

FieldTypeRequired
AdvAdvertiserTrue

Advertiser

 

FieldTypeDescriptionRequirementAccepted Value
IdintA unique number to identify the advertiser.falseThis is set by default when advertiser is created
namestringAdvertiser NameTrue
statusstringDisplays whether advertiser is active or inactive. TrueAccepted values are 'A' for active and 'I' for inactive.
salesContactContactInformation of a sales contact.True
billingContactContactInformation of a person to contact for billing purpose.false
CreatedByintShows who created the advertiser.falseThis is set by default when advertiser is created
createdDatestringDate advertiser was created. falseThis is set by default when advertiser is created
modifiedByintShows who modified advertiser details. falseThis is set by default when advertiser is modified.
modifiedDatestringDate when the advertiser was last modified. falseThis is set by default when advertiser is modified.
actionTypeintActions can be defined at advertiser or campaign level. TrueAccepted values are 0 (Campiagn level action) and 1 (Advertiser level actions)
actionsActions[ ]Number of actions delivered by the advertiser. Actions are mandatory if action Type is set to 1True
tagsTags[ ]Sets the tags for the advertiserFalseMaximum 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 CreateAdvertiserTest {

 public static void main(String[] args) {
 CreateAdvertiserTest.createAdvertiserTest();
 }
 
 private static void createAdvertiserTest() {
 
 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.Advertiser a = new ZEDOAPIStub.Advertiser();

 a.setName("sample_for_test"); // must be set
 a.setActionType(1); // possible values 0 or 1
 a.setStatus("A"); // ignore, but must be set 

 
 a.setMaxLifeTime(12); 
 ZEDOAPIStub.Action[] action = new ZEDOAPIStub.Action[3];

 action[0] = new ZEDOAPIStub.Action();
 action[0].setItemNumber(1); // possible values [1, 10]
 action[0].setName("myName1");
 action[0].setRate(4);
 action[0].setStatus("A"); // ignore, but must be set 
 action[0].setUrl("http://we.ru");

 action[1] = new ZEDOAPIStub.Action();
 action[1].setItemNumber(2);
 action[1].setName("qwerty");
 action[1].setRate(0);
 action[1].setStatus("A");
 action[1].setUrl("http://we.ru");

 action[2] = new ZEDOAPIStub.Action();
 action[2].setItemNumber(5);
 action[2].setName(" ");
 action[2].setRate(999999999e+12);
 action[2].setStatus("A");
 action[2].setUrl("http://we.com");
 a.setActions(action);

 ZEDOAPIStub.Contact c1 = new ZEDOAPIStub.Contact();
 c1.setAddress1("er");
 c1.setAddress2("er");
 c1.setCity("er");
 c1.setCountry("er");
 c1.setEmail("mail");
 c1.setFax("");
 c1.setFirstName("firstName");
 c1.setLastName("er");
 c1.setPhone("er");
 c1.setState("er");
 c1.setZipCode("er");
 a.setBillingContact(c1);

 ZEDOAPIStub.Contact c2 = new ZEDOAPIStub.Contact();
 c2.setAddress1("");
 c2.setAddress2("");
 c2.setCity("");
 c2.setCountry("");
 c2.setEmail("");
 c2.setFax("");
 c2.setFirstName("");
 c2.setLastName("");
 c2.setPhone("");
 c2.setState("");
 c2.setZipCode("");
 a.setSalesContact(c2);

 ZEDOAPIStub.Tag[] tag= new ZEDOAPIStub.Tag[3];
 tag[0] = new ZEDOAPIStub.Tag();
 tag[0].setName("tag5");
 tag[0].setValue("value5");
 tag[1] = new ZEDOAPIStub.Tag();
 tag[1].setName("tag6");
 tag[1].setValue("value6");
 tag[2] = new ZEDOAPIStub.Tag();
 tag[2].setName("tag1");
 tag[2].setValue("value1");
 a.setTags(tag);

 ZEDOAPIStub.CreateAdvertiser ca = new ZEDOAPIStub.CreateAdvertiser();
 ca.setAdv(a);
 Thread.sleep(1000);
 ZEDOAPIStub.CreateAdvertiserResponse car = stub.createAdvertiser(ca);
 
 System.out.println("CREATE_ADVERTISER COMPLETE!");
 System.out.println("PLEASE: " + car.get_return().getId() + " " + car.get_return().getName());

 } catch (Exception e) {
 System.err.println("ERROR: CREATE_ADVERTISER 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 
         */
        
        $advertiser = new Advertiser();
        
        $advertiser->name="NewSampleAdvertiser";
        $advertiser->status="A";
        $advertiser->actionType=1;
        $advertiser->maxLifeTime=15;

        $actions = Array();
        $actions[0] = new Action();
        $actions[0]->itemNumber=1;
        $actions[0]->name="name";
        $actions[0]->rate=4;
        $actions[0]->status="A";
        $actions[0]->url="http://we.ru";
        $actions[1] = new Action();
        $actions[1]->itemNumber=2;
        $actions[1]->name="qwerty";
        $actions[1]->rate=0;
        $actions[1]->status="A";
        $actions[1]->url="http://we.ru";
        $actions[2] = new Action();
        $actions[2]->itemNumber=3;
        $actions[2]->name="name2";
        $actions[2]->rate=99;
        $actions[2]->status="A";
        $actions[2]->url="http://we.ru";
        $advertiser->actions=$actions;
        
        $billingContact = new Contact();
        $billingContact->address1="address1";
        $billingContact->address2="address2";
        $billingContact->city="city";
        $billingContact->companyName="companyName";
        $billingContact->country="country";
        $billingContact->email="email";
        $billingContact->fax="fax";
        $billingContact->firstName="firstName";
        $billingContact->lastName="lastname";
        $billingContact->phone="phone";
        $billingContact->state="state";
        $billingContact->zipCode="zipCode";
        $advertiser->billingContact=$billingContact;
        
        $salesContact = new Contact();
        $salesContact->address1="address1";
        $salesContact->address2="address2";
        $salesContact->city="city";
        $salesContact->companyName="companyName";
        $salesContact->country="country";
        $salesContact->email="email";
        $salesContact->fax="fax";
        $salesContact->firstName="firstName";
        $salesContact->lastName="lastname";
        $salesContact->phone="phone";
        $salesContact->state="state";
        $salesContact->zipCode="zipCode";
        $advertiser->salesContact=$salesContact;
        
       $tag=Array();
       $tag[0]=new Tag();
       $tag[0]->name="tag1";
       $tag[0]->value="value1";
       $tag[1]=new Tag();
       $tag[1]->name="tag2";
       $tag[1]->value="value2";
       $advertiser->tags=$tag;
        $param = new createAdvertiser($advertiser);
        
        /**
         *Execute API Call 
         */
        try {
        $response = $stub->createAdvertiser($param);
        }catch (SoapFault $ex) {
         var_dump($ex->faultcode, $ex->faultstring, $ex->detail);
                echo "CREATE ADVERTISER FAILED\n";
                die();
        }
        
        /**
         * Response
         */
        echo "CREATE ADVERTISER COMPLETE\n\n";
        echo "\nReponse:\n";
        echo $stub->__getLastResponse();

SOAP

Request


<?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:createAdvertiser xmlns:ns5="http://zapi.zedo.com"><ns5:adv><ns1:actionType xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:actionType><actions xmlns="http://client.api.zedo.com/xsd"><itemNumber>1</itemNumber><maxLifeTime>15</maxLifeTime><name>myNameis</name><rate>4.0</rate><status>A</status><url>http://we.ru</url></actions><actions xmlns="http://client.api.zedo.com/xsd"><itemNumber>2</itemNumber><maxLifeTime>10</maxLifeTime><name>qwerty</name><rate>0.0</rate><status>A</status><url>http://we.ru</url></actions><actions xmlns="http://client.api.zedo.com/xsd"><itemNumber>5</itemNumber><maxLifeTime>12</maxLifeTime><name>rty </name><rate>9.0</rate><status>A</status><url>http://we.com</url></actions><billingContact xmlns="http://client.api.zedo.com/xsd"><address1>er</address1><address2>er</address2><city>er</city><country>er</country><email>mail</email><fax></fax><firstName>firstName</firstName><lastName>er</lastName><phone>er</phone><state>er</state><zipCode>er</zipCode></billingContact><ns1:max_lifetime xmlns:ns1="http://client.api.zedo.com/xsd">15</ns1:max_lifetime><ns1:name xmlns:ns1="http://client.api.zedo.com/xsd">ads1</ns1:name><salesContact xmlns="http://client.api.zedo.com/xsd"><address1>drty</address1><address2>ert</address2><city>ert</city><country>sdf</country><email>etf</email><fax>34</fax><firstName>wer</firstName><lastName>wrwe</lastName><phone>52346</phone><state>45</state><zipCode>64</zipCode></salesContact><ns1:status xmlns:ns1="http://client.api.zedo.com/xsd">A</ns1:status>
<tags xmlns="http://client.api.zedo.com/xsd">
<name>tag5</name>
<value>value5</value>
</tags>
<tags xmlns="http://client.api.zedo.com/xsd">
<name>tag6</name>
<value>value6</value>
</tags></ns5:adv></ns5:createAdvertiser></soapenv:Body></soapenv:Envelope>


Response

HTTP/1.1 200 OK
Date: Wed, 20 Jan 2016 12:24:39 GMT
Server: Simple-Server/1.1
Transfer-Encoding: chunked
Content-Type: application/soap+xml; charset=UTF-8; action="urn:createAdvertiserResponse"
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:createAdvertiserResponse xmlns:ns="http://zapi.zedo.com"><ns:return xmlns:ax21="http://base.zedo.com/xsd" xmlns:ax22="http://util.zedo.com/xsd" xmlns:ax25="http://soap.reportengine.zedo.com/xsd" xmlns:ax24="http://client.api.zedo.com/xsd" type="com.zedo.api.client.Advertiser"><ax24:actionType>1</ax24:actionType><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>1</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name>myNameis</ax24:name><ax24:rate>4.0</ax24:rate><ax24:status>A</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>2</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name>qwerty</ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>A</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>3</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>4</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>5</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name>rty </ax24:name><ax24:rate>9.0</ax24:rate><ax24:status>A</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>6</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>7</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>8</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>9</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:actions type="com.zedo.api.client.Action"><ax24:itemNumber>10</ax24:itemNumber><ax24:maxLifeTime>15</ax24:maxLifeTime><ax24:name> </ax24:name><ax24:rate>0.0</ax24:rate><ax24:status>I</ax24:status><ax24:url>http://</ax24:url></ax24:actions><ax24:billingContact type="com.zedo.api.client.Contact"><ax24:address1>er</ax24:address1><ax24:address2>er</ax24:address2><ax24:city>er</ax24:city><ax24:companyName></ax24:companyName><ax24:country>er</ax24:country><ax24:email>mail</ax24:email><ax24:fax></ax24:fax><ax24:firstName>firstName</ax24:firstName><ax24:lastName>er</ax24:lastName><ax24:phone>er</ax24:phone><ax24:state>er</ax24:state><ax24:zipCode>er</ax24:zipCode></ax24:billingContact><ax24:createdBy>41107</ax24:createdBy><ax24:createdDate>2016-01-20 04:24:39</ax24:createdDate><ax24:id>1173688</ax24:id><ax24:max_lifetime>15</ax24:max_lifetime><ax24:modifiedBy>41107</ax24:modifiedBy><ax24:modifiedDate>2016-01-20 04:24:39</ax24:modifiedDate><ax24:name>ads1</ax24:name><ax24:salesContact type="com.zedo.api.client.Contact"><ax24:address1>drty</ax24:address1><ax24:address2>ert</ax24:address2><ax24:city>ert</ax24:city><ax24:companyName></ax24:companyName><ax24:country>sdf</ax24:country><ax24:email>etf</ax24:email><ax24:fax>34</ax24:fax><ax24:firstName>wer</ax24:firstName><ax24:lastName>wrwe</ax24:lastName><ax24:phone>52346</ax24:
phone><ax24:state>45</ax24:state><ax24:zipCode>64</ax24:zipCode></ax24:salesContact><ax24:status>A</ax24:status>
 <ax24:tags type="com.zedo.api.client.Tag">
 <ax24:name>tag5</ax24:name>
 <ax24:value>value5</ax24:value>
 </ax24:tags>
 <ax24:tags type="com.zedo.api.client.Tag">
 <ax24:name>tag6</ax24:name>
 <ax24:value>value6</ax24:value>
 </ax24:tags></ns:return></ns:createAdvertiserResponse></soapenv:Body></soapenv:Envelope>