You are here: Custom Attributes > getEntityCustomAttributes

Find a Custom Attribute by Template Type and Entity ID

Description

Finds a custom attribute by template type and entity ID.

Default Protocol Method Type URI
HTTPS GET getEntityCustomAttributes.xml

Query Parameters

Parameter Description Valid Values Optional
templateType

EMS Entity for which the custom attribute is defined. Possible values are:

  • 1(Feature)
  • 2(Product)
  • 4(Customer)
  • 5(Contact)
  • 6(Entitlement)
Integer No
entityId Id of the entity for which you the custom attribute is being retrieved. Integer No

Sample Code

import java.io.IOException;
import java.net.URLDecoder;

//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
	private static DefaultHttpClient httpclient = new DefaultHttpClient();
	private static Principal principal = null;
	private static StringBuffer query;
	//..............................
	//..............................
	//..............................
	public static String getEntityCustomAttributes.xml()throws Exception  {
		if(!verifyLogin()){
			return "login failed";
		}
		HttpContext context = new BasicHttpContext();
		context.setAttribute(ClientContext.USER_TOKEN, principal);
		HttpGet get = new HttpGet("https://localhost:8443/ems/3.6/getEntityCustomAttributes.xml");
		query = new StringBuffer();
		setParameter("templateType", "1");
		setParameter("entityId", "3");
		get.setURI(new URI(URLDecoder.decode(get.getURI() + query.toString(),"UTF-8")));
		HttpResponse response = httpclient.execute(get, 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);
	}
	static void setParameter(String key, String value) {
		if (query.toString().equals("")) {
			query.append("?" + key + "=" + value + "&");
		} else {
			query.append(key + "=" + value + "&");
		}
	}
}
  

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<emsResponse>
   <entityId>1</entityId>
   <entityName>F24</entityName>
   <stat>ok</stat>
   <template>
      <templat>
         <attributeId>1</attributeId>
         <attributeName>FeatureAuthor</attributeName>
         <dataType>STRING</dataType>
         <dataTypeCode>1</dataTypeCode>
         <optional>false</optional>
         <regularExpression />
         <value>Dave</value>
      </templat>
      <templat>
         <attributeId>5</attributeId>
         <attributeName>CrossPlatform</attributeName>
         <dataType>BOOLEAN</dataType>
         <dataTypeCode>4</dataTypeCode>
         <optional>false</optional>
         <regularExpression />
         <value>1</value>
      </templat>
   </template>
   <templateType>Feature</templateType>
</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.
118 {field} should be of data type integer. [Note: This error code is applicable for the fields - featureId, License modelId, entId, ftrId, customerId, lmId, templateType, lineItemId, CustomerId, stationCount, status, and granularity.]
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.
301 Unable to find product for ID ‘Id’
309 Unable to find feature.
711 Invalid Template Type!
712 Entity not found.
1081 Invalid Web service version provided
1084 No Web service version provided
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.
1169 Unable to find contact for ID {contactId}
1170 Unable to find customer for ID {customerId}
1171 Unable to find entitlement for ID