You are here: Usage Information > retrieveCurrentUsageCount

Retrieve Current Usage Count

Description

Retrieves total usage and actual consumption of features having prepaid license model.

Default Protocol Method Type URI

HTTPS

GET

retrieveCurrentUsageCount.xml

Query Parameters

Parameter Description Valid Values Optional

entId

Identifier of the entitlement.

Note: The entId is the handle returned by the createEntitlement.xml web service. You can use the searchEntitlements.xml web service to retrieve entId for an entitlement.

Integer

No

productName Name of the product.

String

No
productVersion Version of the product. String 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 retrieveCurrentUsageCount.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/retrieveCurrentUsageCount.xml");
            query = new StringBuffer();
            setParameter("entId", "1");
            setParameter("productVersion", "1");
            setParameter("productName", "mix3");
            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" standalone="yes"?>
<emsResponse>
  <stat>ok</stat>
  <currentUsageCounts>
    <currentUsageCount>
      <featureName>feat_prepaid</featureName>
      <totalCount>100</totalCount>
      <usageCount>3</usageCount>
    </currentUsageCount>
  </currentUsageCounts>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description

101

You are not authorized to use this service.

112 The input string is not valid.

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.
302

No product exists for given Name and Version.

621

Entitlement does not exist. Retry with a correct ID.

658

Entitlement is not in complete state, please contact administrator.

1053 No PrePaid license model found associated with the product {ProductName.}
1071 Not supported for On-Premise entitlement.
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.