You are here: Entitlement Management > Entitlement Line Item > getEntitlementItemByCriteria

Retrieve Line Item Details By Criteria

Description

Retrieves line Item details based on the specified criteria.

Default Protocol Method Type URI
HTTPS GET getEntitlementItemByCriteria.xml

Query Parameters

Parameter Description Valid Values Optional
refId1 Information that uniquely identifies the line item in a different ERP system. String Yes
refId2 A second unique reference ID, similar to Ref ID 1. String Yes
lastModified Creation or modification timestamp of the line item. Long Yes

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 getEntitlementItemByCriteria.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/getEntitlementItemByCriteria.xml");
		query = new StringBuffer();
		setParameter("refId2", "ref2");
		setParameter("lastModified", "1327379905000");
		setParameter("refId1", "ref1");
		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>
  <stat>ok</stat>
  <lineItems>
    <lineItem>
      <lineItemId>8</lineItemId>
      <lineItemName>P1</lineItemName>
      <status>0</status>
      <type>service</type>
      <enforcement>
        <enforcementId>1</enforcementId>
        <enforcementName>Sentinel Cloud</enforcementName>
        <enforcementVersion>3.5.0</enforcementVersion>
      </enforcement>
      <entitlement>
        <entId>8</entId>
        <eid>f68a2c****</eid>
        <timezone>(GMT) Greenwich Mean Time, : Dublin, Edinburgh, Lisbon, London</timezone>
      </entitlement>
      <itemProduct>
        <itemFeatureLicenseModels>
          <itemFeatureLicenseModel>
            <entFtrLMId>15</entFtrLMId>
            <feature>
              <id>2</id>
              <featureName>F2</featureName>
              <featureId>2</featureId>
            </feature>
            <licenseModel>
              <licenseModelId>1</licenseModelId>
              <licenseModelName>Subscription</licenseModelName>
            </licenseModel>
          </itemFeatureLicenseModel>
          <itemFeatureLicenseModel>
            <entFtrLMId>16</entFtrLMId>
            <feature>
              <id>1</id>
              <featureName>F1</featureName>
              <featureId>1</featureId>
            </feature>
            <licenseModel>
              <licenseModelId>2</licenseModelId>
              <licenseModelName>Postpaid</licenseModelName>
            </licenseModel>
          </itemFeatureLicenseModel>
        </itemFeatureLicenseModels>
        <product>
          <productId>1</productId>
          <productName>P1</productName>
          <productVersion>3.5</productVersion>
          <refId1/>
          <refId2/>
        </product>
        <itemServiceAgreement>
          <entProductSAId>8</entProductSAId>
          <serviceAgreement>
            <serviceAgreementId>1</serviceAgreementId>
            <serviceAgreementName>Service Agreement Template</serviceAgreementName>
          </serviceAgreement>
        </itemServiceAgreement>
      </itemProduct>
      <refId1>fl-ref1</refId1>
      <refId2>fl-ref2</refId2>
      <creationTime>1402476206000</creationTime>
      <modificationTime>1402479433000</modificationTime>
    </lineItem>
  </lineItems>
  <total>1</total>
</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.
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.]
128 You should log on first.
1080 {field} should be of dataType long. [Note: This error code is applicable for the field - lastModified.]
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.