Home » createUser

createUser

Description

Creates a new user

To create a User set the required values in the User object. This User object should be set in the User field of the createUser call.

To create a User for role type Custom Adtrafficker:  advertisers[ ] and publishers[ ] need to be set.

To create User for role type Custom Advertiser: advertisers[ ] and campaigns[ ] need to be set. If campaigns[ ] is not populated than by default it is considered as all current and future campaigns.

Attributes

FieldTypeRequired
UserUserTrue

User

FieldTypeDescriptionRequiredAccepted Value
idintA unique number to identify a user. FalseThis is set by default when user is created.
loginstringUser's login ID (unique email address)True
passwordstringUser's passwordTruePassword should contain atleast 1 upper case, 1 lowercase, 1 number , and a special character and minimum 8 characters. Allowed special characters are: !@#$^~.,_-
statusstringDisplays whether the user is active and can access the account or is inactive without access rights. TrueAccepted values are 'A' for active and 'I' for inactive.
roleIdintA unique number to identify the role of the userTrue
contactcontactUsers contact informationFalse
browserLanguageTypeIdintLanguage displayed for the user. TrueThe accepted values are: 1 for English, 3 for French, 6 for Japanese and 28 for Russian
advertisersAccessEntity[ ]Advertisers needed for this users False
campaignsAccessEntity[ ]Campaigns needed for these usersFalse
publishersAccessEntity[ ]Publishers needed for these usersFalse

Samples

Java

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

public class CreateUserTest {

    public static void main(String[] args) {
        CreateUserTest.createUserTest();
    }
    
    private static void createUserTest() {
        
        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.User u = new ZEDOAPIStub.User();

 u.setLogin("sampleuser@zedo.com");
 u.setPassword("Strong@123");
 u.setRoleId(84121);
 u.setStatus("A");
 u.setBrowserLanguageTypeId(1);

 ZEDOAPIStub.Contact c1 = new ZEDOAPIStub.Contact();
 c1.setAddress1("a");
 c1.setAddress2("d");
 c1.setCity("r");
 c1.setCountry("w");
 c1.setEmail("abcd@af.com");
 c1.setFax("");
 c1.setFirstName("DimaTest1");
 c1.setLastName("DimaTest2");
 c1.setPhone("");
 c1.setState("");
 c1.setZipCode("");
 u.setContact(c1);
 
 
 
 ZEDOAPIStub.AccessEntity[] ae= new ZEDOAPIStub.AccessEntity[3];
 ae[0]= new ZEDOAPIStub.AccessEntity();
 ae[0].setId(1765357);
 ae[0].setStatus("A");
 ae[1]=new ZEDOAPIStub.AccessEntity();
 ae[1].setId(1524635);
 ae[1].setStatus("A");
 ae[2]= new ZEDOAPIStub.AccessEntity();
 ae[2].setId(1390293);
 ae[2].setStatus("A");
 
 u.setAdvertisers(ae);
 
 ZEDOAPIStub.AccessEntity[] ae1= new ZEDOAPIStub.AccessEntity[4];
 ae1[0]= new ZEDOAPIStub.AccessEntity();
 ae1[0].setId(1765358);
 ae1[0].setStatus("A");
 ae1[1]=new ZEDOAPIStub.AccessEntity();
 ae1[1].setId(1524636);
 ae1[1].setStatus("A");
 ae1[2]=new ZEDOAPIStub.AccessEntity();
 ae1[2].setId(1395734);
 ae1[2].setStatus("A");
 ae1[3]=new ZEDOAPIStub.AccessEntity();
 ae1[3].setId(1404052);
 ae1[3].setStatus("A");
 u.setCampaigns(ae1);

 ZEDOAPIStub.CreateUser cu = new ZEDOAPIStub.CreateUser();
 cu.setUser(u);
 Thread.sleep(1000);
 ZEDOAPIStub.CreateUserResponse cur = stub.createUser(cu);
 System.out.println("CREATE_USER COMPLETE!");
 System.out.println("PLEASE: " + cur.get_return().getId() + " "
 + cur.get_return().getLogin());
        } catch (Exception e) {
            System.err.println("ERROR: CREATE_USER 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 
 */
 $user = new User();
 
 $user->login="sampleuser@zedo.com";
 $user->password="Strong@123";
 $user->roleId=35621; //An unique number to identify role of the user
 $user->status="A";
 $user->browserLanguageTypeId=1;
 
 $contact = new Contact();
 $contact->address1="address1";
 $contact->address2="address2";
 $contact->city="city";
 $contact->companyName="companyName";
 $contact->country="country";
 $contact->email="email";
 $contact->fax="fax";
 $contact->firstName="firstName";
 $contact->lastName="lastname";
 $contact->phone="phone";
 $contact->state="state";
 $contact->zipCode="zipCode";
 $user->contact=$contact;

 //sets the advertisers for the user
 $accessEntity=Array();
 $accessEntity[0] = new AccessEntity();
 $accessEntity[0]->id=524315;
 $accessEntity[0]->status="A";
 $accessEntity[1] = new AccessEntity();
 $accessEntity[1]->id=522930;
 $accessEntity[1]->status="A";
 $user->advertisers=$accessEntity;


 //sets the campaigns for the user
 $accessEntity=Array();
 $accessEntity[0] = new AccessEntity();
 $accessEntity[0]->id=582391;
 $accessEntity[0]->status="A";
 $accessEntity[1] = new AccessEntity();
 $accessEntity[1]->id=527574;
 $accessEntity[1]->status="A";
 $user->campaigns=$accessEntity;

 
 $param = new createUser($user);
 
 /**
 *Execute API Call 
 */
 try {
 $response = $stub->createUser($param);
 }catch (SoapFault $ex) {
 var_dump($ex->faultcode, $ex->faultstring, $ex->detail);
 echo "CREATE USER FAILED\n";
 die();
 }
 
 /**
 * Response
 */
 echo "CREATE USER COMPLETE\n\n";
 echo "\nReponse:\n";
 echo $stub->__getLastResponse();


SOAP

Request

POST /axis2/services/ZEDOAPI?wsdl HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="urn:createUser"
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:createUser xmlns:ns5="http://zapi.zedo.com">
<ns5:user>
<advertisers xmlns="http://client.api.zedo.com/xsd">
<id>1156972</id>
<status>A</status>
</advertisers>
<advertisers xmlns="http://client.api.zedo.com/xsd">
<id>1049884</id>
<status>A</status>
</advertisers>
<ns1:browserLanguageTypeId xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:browserLanguageTypeId>
<contact xmlns="http://client.api.zedo.com/xsd">
<address1>d</address1>
<address2>d</address2>
<city>r</city>
<country>w</country>
<email>efwf@af.com</email>
<fax>
</fax>
<firstName>DimaTest1</firstName>
<lastName>DimaTest2</lastName>
<phone>
</phone>
<state>
</state>
<zipCode>
</zipCode>
</contact>
<ns1:login xmlns:ns1="http://client.api.zedo.com/xsd">test12389@zedo.com</ns1:login>
<ns1:password xmlns:ns1="http://client.api.zedo.com/xsd">Strong@123</ns1:password>
<publishers xmlns="http://client.api.zedo.com/xsd">
<id>586328</id>
<status>A</status>
</publishers>
<ns1:roleId xmlns:ns1="http://client.api.zedo.com/xsd">112773</ns1:roleId>
<ns1:status xmlns:ns1="http://client.api.zedo.com/xsd">A</ns1:status>
</ns5:user>
</ns5:createUser>
</soapenv:Body>
</soapenv:Envelope>

Response

HTTP/1.1 200 OK
Date: Wed, 20 Jan 2016 06:26:02 GMT
Server: Simple-Server/1.1
Transfer-Encoding: chunked
Content-Type: application/soap+xml; charset=UTF-8; action="urn:createUserResponse"


<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:createUserResponse 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.User">
<ax24:advertisers type="com.zedo.api.client.AccessEntity">
<ax24:id>1156972</ax24:id>
<ax24:status>A</ax24:status>
</ax24:advertisers>
<ax24:advertisers type="com.zedo.api.client.AccessEntity">
<ax24:id>1049884</ax24:id>
<ax24:status>A</ax24:status>
</ax24:advertisers>
<ax24:browserLanguageTypeId>1</ax24:browserLanguageTypeId>
<ax24:campaigns xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<ax24:contact type="com.zedo.api.client.Contact">
<ax24:address1>d</ax24:address1>
<ax24:address2>d</ax24:address2>
<ax24:city>r</ax24:city>
<ax24:companyName>
</ax24:companyName>
<ax24:country>w</ax24:country>
<ax24:email>efwf@af.com</ax24:email>
<ax24:fax>
</ax24:fax>
<ax24:firstName>DimaTest1</ax24:firstName>
<ax24:lastName>DimaTest2</ax24:lastName>
<ax24:phone>
</ax24:phone>
<ax24:state>
</ax24:state>
<ax24:zipCode>
</ax24:zipCode>
</ax24:contact>
<ax24:id>1173608</ax24:id>
<ax24:login>test12389@zedo.com</ax24:login>
<ax24:password/>
<ax24:publishers type="com.zedo.api.client.AccessEntity">
<ax24:id>586328</ax24:id>
<ax24:status>A</ax24:status>
</ax24:publishers>
<ax24:roleId>112773</ax24:roleId>
<ax24:status>A</ax24:status>
</ns:return>
</ns:createUserResponse>
</soapenv:Body>
</soapenv:Envelope>