You are here: Catalog Elements > License Model > getLicenseModelById

Retrieve a License Model By ID

Description

Retrieves information of a license model, such as its ID, name, and description by license model ID.

Default Protocol Method Type URI
HTTPS GET getLicenseModelById.xml

Query Parameters

Parameter Description Valid Values Optional
lmId Specify the license model ID. int 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 getLicenseModelById.xml()throws Exception  {
		if(!verifyLogin()){
			return "login failed";
		}
		HttpContext context = new BasicHttpContext();
		context.setAttribute(ClientContext.USER_TOKEN, principal);
		HttpGet get = new HttpGet("https://localhost:8080/ems/3.6/getLicenseModelById.xml");
		query = new StringBuffer();
		setParameter("lmId", "1");
		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

<emsResponse>
  <licenseModelDetail>
    <copyLMId>2</copyLMId>
    <creationTime>1383193610000</creationTime>
    <description>Postpaid License Model</description>
    <enfId>1</enfId>
    <groups>
      <group>
        <licenseModelGroupName>Vendor
        Attribute</licenseModelGroupName>
        <subGroups>
          <subGroup>
            <Attributes>
              <Attribute>
                <id>16</id>
                <name>Vendor Attribute</name>
                <overridable>2</overridable>
                <value />
              </Attribute>
            </Attributes>
            <licenseModelSubGroupName>Vendor
            Attribute</licenseModelSubGroupName>
          </subGroup>
        </subGroups>
      </group>
      <group>
        <licenseModelGroupName>Time</licenseModelGroupName>
        <subGroups>
          <subGroup>
            <Attributes>
              <Attribute>
                <id>1</id>
                <name>START_DATE</name>
                <overridable>2</overridable>
                <value>2012-01-01 00:00</value>
              </Attribute>
              <Attribute>
                <id>2</id>
                <name>END_DATE</name>
                <overridable>2</overridable>
                <value>2014-01-01 23:59</value>
              </Attribute>
            </Attributes>
            <licenseModelSubGroupName>License
            Validity</licenseModelSubGroupName>
          </subGroup>
        </subGroups>
      </group>
      <group>
        <licenseModelGroupName>Capacity
        Attribute</licenseModelGroupName>
        <subGroups>
          <subGroup>
            <Attributes>
              <Attribute>
                <id>17</id>
                <name>Capacity Attribute</name>
                <overridable>2</overridable>
                <value />
              </Attribute>
            </Attributes>
            <licenseModelSubGroupName>Capacity
            Attribute</licenseModelSubGroupName>
          </subGroup>
        </subGroups>
      </group>
      <group>
        <licenseModelGroupName>Usage Type</licenseModelGroupName>
        <subGroups>
          <subGroup>
            <Attributes>
              <Attribute>
                <id>4</id>
                <name>Usage Type</name>
                <overridable>2</overridable>
                <value>2</value>
              </Attribute>
            </Attributes>
            <licenseModelSubGroupName>Usage
            Type</licenseModelSubGroupName>
          </subGroup>
        </subGroups>
      </group>
    </groups>
    <licenseModelName>Postpaid</licenseModelName>
    <modificationTime>1383193610000</modificationTime>
    <refId1 />
    <refId2 />
    <total>4</total>
  </licenseModelDetail>
  <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
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.]
411 License model does not exist.
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.