You are here: Usage Information > getCustomerUsageLogBasedOnVendorInfo

Retrieve Customer Usage Log for Vendor Information

Description

Returns the usage log details of a customer grouped by vendor information.

For example, you can use this Web service to filter usage data based on a user's role, region, or department. This report is generated based on the vendor-specific information specified in Run-time during the login call, using the optional parameter ‘VendorData’. See Run-time Guide for details.

Default Protocol Method Type URI
HTTPS GET getCustomerUsageLogBasedOnVendorInfo.xml

Query Parameters

Parameter Description Valid Values Optional
customerId The unique record ID of the customer in EMS database. Integer No
startDate

Start date from when the usage log is to be obtained.

The startDate should be earlier than or same as the enddate.

Date No
endDate End date till when the usage log is to be obtained. Date No
featureId

Feature ID.

Please note that ftrId and featureId are different.

  • ftrId: It is an auto-generated, unique record ID of a feature in EMS database.
  • featureId: It is the unique identification code provided by software provider for a feature. It is used in license enforcement.

Integer

(>0)

Yes
featureName

The unique feature name.

The authorization is done either on featureID or on featureName. You should provide only one of these feature identifiers; otherwise an error is returned.

String Yes
vendorData

Filters the records based on the value of the 'VendorData' attribute provided during the login Run-time API call. Possible values are:

  • 0 : Do not retrieve records where the VendorData value is Null or blank. This is the default value.
  • 1 : Retrieve all records including those having Null or blank VendorData values.
Integer Yes
usageType

Type of data aggregation. Possible values are 1 (Count Based) and 2 (Time Based).

Integer Yes
status

Specifies whether or not to include revoked entitlements in the response. Possible values are:

  • 3 : Include revoked entitlements in the response. This is the default value.
  • 4: Do not include revoked entitlements in the response.
Integer Yes
pageIndex Index of the currently displayed page. Integer (>0) Default Value: 1 Yes
pageSize

Number of records to be displayed on a page.

Its default value can be configured from EMS Admin Console by using the Max Records Per Response (Web Services) property.

Integer (>0) 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 getCustomerUsageLogBasedOnVendorInfo.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/getCustomerUsageLogBasedOnVendorInfo.xml");
    query = new StringBuffer();
    setParameter("featureName", "Add");
    setParameter("startDate", "2014-01-01");
    setParameter("vendorData", "1");
    setParameter("customerId", "1");
    setParameter("status", "1");
    setParameter("pageSize", "200");
    setParameter("featureId", "1");
    setParameter("usageType", "1");
    setParameter("endDate", "2016-01-01");
    setParameter("pageIndex", "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>
  <customerName>LM</customerName>
  <customerRefId>E00000005</customerRefId>
  <stat>ok</stat>
  <total>6</total>
  <usageData>
    <usageInfoList>
      <usageInfo>
        <features>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>2</usageType>
            <usageValue>5</usageValue>
          </feature>
        </features>
        <vendorInfo>sample vendor datasample sample vendor
        datasample vendor datasample vendor datasample vendor
        datasample vendor datasample vendor datasample vendor
        datasample vendor datasample vendor datasample vendor
        datasample vendor datasample vendor datasample
        vendor</vendorInfo>
      </usageInfo>
      <usageInfo>
        <features>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>1</usageType>
            <usageValue>100</usageValue>
          </feature>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>2</usageType>
            <usageValue>107</usageValue>
          </feature>
        </features>
        <vendorInfo>vendor1</vendorInfo>
      </usageInfo>
      <usageInfo>
        <features>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>1</usageType>
            <usageValue>100</usageValue>
          </feature>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>2</usageType>
            <usageValue>100</usageValue>
          </feature>
        </features>
        <vendorInfo>vendor2</vendorInfo>
      </usageInfo>
      <usageInfo>
        <features>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>1</usageType>
            <usageValue>100</usageValue>
          </feature>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>2</usageType>
            <usageValue>100</usageValue>
          </feature>
        </features>
        <vendorInfo>vendor3</vendorInfo>
      </usageInfo>
      <usageInfo>
        <features>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>1</usageType>
            <usageValue>100</usageValue>
          </feature>
        </features>
        <vendorInfo>vendor4</vendorInfo>
      </usageInfo>
      <usageInfo>
        <features>
          <feature>
            <featureID>2</featureID>
            <featureName>Feat</featureName>
            <usageType>2</usageType>
            <usageValue>100</usageValue>
          </feature>
        </features>
        <vendorInfo>vendor5</vendorInfo>
      </usageInfo>
    </usageInfoList>
  </usageData>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
101 You are not authorized to use this service.
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.]
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.]
123 endDate should be of dataType Date in the format yyyy-mm-dd startDate should be of dataType Date in the format yyyy-mm-dd.
128 You should log on first.
512 The customer does not exist.
617 Start date cannot be greater than end date.
1081 Invalid Web service version provided
1084 No Web service version provided
1102 Maximum pageIndex allowed for specified size is 1.
1176 Invalid {field}. Note: This error code is applicable for the following fields: formatType, outputMode, vendorData, and status.
1191 Invalid request, either {field0} or {field1} should be provided in the request. Here, {field0} represents featureId, entId, or eid; and {field1} represents featureName or status.