You are here: Catalog Elements > Feature > addFeature

Add Feature

Description

Add a feature to a particular namespace.

Default Protocol Method Type URI
HTTPS POST addFeature.xml

Post Parameters

Parameter Description Valid Values Optional
namespaceName Specify the namespace. String No
featureName

Specify the unique feature name.

The feature name should be unique across all namespaces.

String No
featureDescription Description of the feature. String Yes
licenseModelIds IDs corresponding to the license models chosen.

String (1,2, 3…)

No
defaultLicenseModelId Specify the default license model. Integer (one of license model Id from licenseModelIds) No
isAutoGenerate

Valid values are True or False.

If True, then featureid is generated automatically, otherwise the user needs to enter featureID.

Default Value: True

Boolean

No
featureID

Feature ID. It needs to be entered if isAutogenerate is false.

Feature ID should be in the range 1-65471 for on-premise entitlements.

Integer

Mandatory if isAutogenerate is false.
refId1 Identifier 1 to store the unique record ID as used by external ERP/CRM systems. String Yes
refId2 A second unique reference ID, similar to Ref ID 1. String Yes

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 addFeature.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/addFeature.xml");
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("featureName", "test"));
		nvps.add(new BasicNameValuePair("namespaceName", "char"));
		nvps.add(new BasicNameValuePair("refId2", "Fref2"));
		nvps.add(new BasicNameValuePair("licenseModelIds", "1"));
		nvps.add(new BasicNameValuePair("refId1", "Fref1"));
		nvps.add(new BasicNameValuePair("featureDescription", "test+feature"));
		nvps.add(new BasicNameValuePair("featureID", "999"));
		nvps.add(new BasicNameValuePair("defaultLicenseModelId", "1"));
		nvps.add(new BasicNameValuePair("isAutoGenerate", "false"));
		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> 
   <ftrId>54</ftrId> 
   <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.
107 An internal error occurred! Please report the error to System administrator.
115 Length of {field} is {actual value}. It cannot be more Than {max value}. [Note: This error code is applicable for the fields - billAddr, billAddrCity, billAddrCountry, billAddrState, billAddrZip, shipAddr, shipAddrCity, shipAddrCountry, shipAddrState, shipAddrZip, refId1, refId2, contactPassword, description, and default value.]
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.]
120 {field} value is less than the minimum permitted value {value}. [Note: This error code is applicable for the fields - productd, featureId,entId, billType, lmId, lastModified, timeZoneId, customerId, 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.
132 The URL address does not exist.
133 Invalid namespace.
322 This Namespace does not exists in the system.
323 Feature {feature} already exists. Try again with different name.
345 featureId is mandatory.
411 License model does not exist.
412 Default license model is not from license Model list.
1027 The specified featureID already exists
1079 Please enter a valid Feature ID, in the range 1-999999.
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.