Home » updateUser

updateUser

Description

Updates the user with the given user sequence ID

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

To update User having 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.false This is set by default when user is created.
loginstringUser's login ID ( unique email address ).false
passwordstringUser's passwordfalsePassword should contain atleast 1 upper case, 1 lowercase, 1 number , a special character and minimum of 8 characters. Allowed special characters are: !@#$^~.,_-
statusstringDisplays whether the user is active and can access the account or is inactive without access rights. falseAccepted values are 'A' for active and 'I' for inactive.
roleIdintAn unique number to identify the role of the user.false
contactContactUser's 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 UpdateUserTest {

 public static void main(String[] args) {
 UpdateUserTest.updateUserTest();
 }
 
 private static void updateUserTest() {
 
 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.GetUser req = new ZEDOAPIStub.GetUser();
 req.setId(482277);
 Thread.sleep(1000);
 ZEDOAPIStub.GetUserResponse res = stub.getUser(req);
 ZEDOAPIStub.User u = res.get_return();
 
 u.setPassword("Strong@123");
 u.setRoleId(109773);
 u.setStatus("A");
 
 
 ZEDOAPIStub.AccessEntity ae1 = new ZEDOAPIStub.AccessEntity();
 ae1.setId(361534);
 ae1.setStatus("A");
 
 u.addAdvertisers(ae1);
 
 ZEDOAPIStub.AccessEntity ae2 = new ZEDOAPIStub.AccessEntity();
 ae2.setId(1086974);
 ae2.setStatus("A");
 
 u.addAdvertisers(ae2);
 
 
 ZEDOAPIStub.AccessEntity ae3 = new ZEDOAPIStub.AccessEntity();
 ae3.setId(1086975);
 ae3.setStatus("A");
 
 u.addCampaigns(ae3);
 
 ZEDOAPIStub.AccessEntity ae4 = new ZEDOAPIStub.AccessEntity();
 ae4.setId(1168261);
 ae4.setStatus("A");
 
 u.addCampaigns(ae4);
 
 
 for(AccessEntity ae : u.getAdvertisers()) {
 if(ae.getId()==1390293) {
 ae.setStatus("I");
 }
 }
 
 for(AccessEntity ae5 : u.getCampaigns()) {
 if(ae5.getId()==361783) {
 ae5.setStatus("I");
 }
 
 }
 
 
 ZEDOAPIStub.UpdateUser up = new ZEDOAPIStub.UpdateUser();
 up.setUser(u); 
 Thread.sleep(1000);
 stub.updateUser(up);
 
 System.out.println("UPDATE_USER COMPLETE!");
 System.out.println("PLEASE: " + up.getUser().getId() + " " + up.getUser().getLogin() + " " + up.getUser().getContact().getAddress1());

 } catch (Exception e) {
 System.err.println("ERROR: UPDATE_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_id = 601171;
 $param = new getUser($user_id);
 
 /**
 *Execute API Call 
 */
 try {
 $response = $stub->getUser($param);
 }catch (SoapFault $ex) {
 var_dump($ex->faultcode, $ex->faultstring, $ex->detail);
 echo "GET USER FAILED\n";
 die();
 }
 
 /**
 * Response
 */
 $tmp = new getUserResponse($response);
 $tmp = $tmp->return;
 $user = $tmp->return;
 /**
 * Edit User
 */

 $user->password="strong123";

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

 $user->advertisers=$accessEntity;


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

 $updateUser = new updateUser($user);
 try {
 $response = $stub->updateUser($updateUser);
 } catch (SoapFault $ex) {
 var_dump($ex->faultcode, $ex->faultstring, $ex->detail);
 echo "UPDATE USER FAILED\n";
 die();
 }
 /**
 * Response
 */
 echo "UPDATE 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:updateUser"
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:updateUser xmlns:ns5="http://zapi.zedo.com">
<ns5:user>
<advertisers xmlns="http://client.api.zedo.com/xsd">
<id>1049884</id>
<status>I</status>
</advertisers>
<advertisers xmlns="http://client.api.zedo.com/xsd">
<id>1156972</id>
<status>A</status>
</advertisers>
<ns1:browserLanguageTypeId xmlns:ns1="http://client.api.zedo.com/xsd">1</ns1:browserLanguageTypeId>
<ns1:campaigns xmlns:ns1="http://client.api.zedo.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" />
<contact xmlns="http://client.api.zedo.com/xsd">
<address1>d</address1>
<address2>d</address2>
<city>r</city>
<companyName>
</companyName>
<country>w</country>
<email>efwf@af.com</email>
<fax>
</fax>
<firstName>DimaTest1</firstName>
<lastName>DimaTest2</lastName>
<phone>
</phone>
<state>
</state>
<zipCode>
</zipCode>
</contact>
<ns1:id xmlns:ns1="http://client.api.zedo.com/xsd">1173608</ns1:id>
<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:updateUser>
</soapenv:Body>
</soapenv:Envelope>

Response

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