You are here: Authorization > setPassword

Set Password

Description

This web service allows an EMS user having administrator rights to reset the password of other EMS users (including customer's contacts).

This web service does not allow the logged-in EMS administrator to change his/her own password. To do so, the Change Password web service should be used.

Default Protocol Method Type URI
HTTPS POST setPassword.xml

Post Parameters

Parameter Description Valid Values Optional
loginId User ID or e-mail ID of the EMS user whose password you want to change. String No
newPassword

New password to be associated with the loginId.

Password is case sensitive and its length should be between 6 to 30 characters.

String No

Sample Code

import java.io.IOException;
//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
	private static DefaultHttpClient httpclient = new DefaultHttpClient();
	private static Principal principal = null;
//..............................
//..............................
//..............................
public static String setPassword.xml()throws Exception {
    if(!verifyLogin()){
        	return "login failed";
    }
    	HttpContext context = new BasicHttpContext();
    	context.setAttribute(ClientContext.USER_TOKEN, principal);
    	HttpPost post =  new HttpPost(""https://localhost:8443/ems/3.6/setPassword.xml");
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    	nvps.add(new BasicNameValuePair("loginId", "abc%40gmail.com"));
    	nvps.add(new BasicNameValuePair("newPassword", "temp1234"));
    	post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
    HttpResponse response = httpclient.execute(post, context);
    HttpEntity entity = response.getEntity();
    byte[] b = null;
    if (entity != null) {
        long l = entity.getContentLength();
         b = new byte[(int) l];
         entity.getContent().read(b);
         entity.consumeContent();
     	}
    	return new String(b);
    	}
    	}

Sample Response

<emsResponse>
  <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
101 You are not authorized to use this service.
122 {field} is a required field and should have a not null value. [Note: This error code is applicable for the fields - Eid, namespaceName, featureName, startDate, endDate, userIds, featureId, productName, productVersion, detailsLM, lmId, templateType, customAttribute, lineItemId, customerRefId, granularity, loginId, oldPassword, and newPassword.]
128 You should log on first.
1159 The loginId is incorrect.
1160 Password should be minimum 6 characters long.
1161 Password can be maximum 30 characters long.
1162 Please call Change Password web service to change your password.