You are here: Authorization > changePassword

Change Password

Description

This Web service allows logged-in users to change their own password.

Authentication is done based on the old password, and the current login session is closed after the password has been changed.

Default Protocol Method Type URI
HTTPS POST changePassword.xml

Post Parameters

Parameter Description Valid Values Optional
oldPassword The old password. String No
newPassword

The new password.

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 changePassword.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/changePassword.xml");
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    	nvps.add(new BasicNameValuePair("newPassword", "temp1234"));
    	nvps.add(new BasicNameValuePair("oldPassword", "temp123"));
    	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

<?xml version="1.0" encoding="UTF-8"?> 
<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.
215 Either username or password is incorrect.
1160 Password should be minimum 6 characters long.
1161 Password can be maximum 30 characters long.