You are here: Custom Attributes > updateCustomAttribute

Update Custom Attribute

Description

Updates the custom attributes of an entity.Its input is the XML string returned by the getEntityCustomAttributes Web service.

In the input XML, only the <value> tag can be modified and the remaining information is treated as read-only. If the custom attribute is created for a Boolean data type, the <value> tag can have only two values 0 or 1, where 0 = False and 1 = True.

Default Protocol Method Type URI
HTTPS POST updateCustomAttribute.xml

POST Parameters

Parameter Description Valid Values Optional
customAttribute XML string returned by getEntityCustomAttributes 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 updateCustomAttribute.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/updateCustomAttribute.xml");
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("customAttribute", ""));
		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
100 Invalid request parameter.
101 You are not authorized to use this service.
102 Invalid data entered.
107 An internal error occurred! Please report the error to System administrator.
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.
711 Invalid Template Type!
713 Invalid Boolean value {value} passed. Provide a valid value(0 or 1).
717 Invalid entityId or custom attribute.
1081 Invalid Web service version provided
1084 No Web service version provided
1086 template attribute (x) already exists. Try again with a different name.
1087 No custom attribute exists for attributeId {Id}.
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.