This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Usages in Kill Bill

The getUsageOfSubscription operation retrieves the usage of the subscription .

getUsageOfSubscription
<killbill.getUsageOfSubscription>
    <subscriptionId>{$ctx:subscriptionId}</subscriptionId>
    <startDate>{$ctx:startDate}</startDate>
    <endDate>{$ctx:endDate}</endDate>
</killbill.getUsageOfSubscription>
Properties
  • subscriptionId: The id of the subscription.
  • startDate: The start date of the usage period.
  • endDate: The end date of the usage period.
Sample request

Following is a sample REST/JSON request that can be handled by the getUsageOfSubscription  operation.

Sample Request for getUsageOfSubscription
{
    "apiUrl":"http://127.0.0.1:8080",
    "apiVersion":"1.0",
    "username":"admin",
    "password":"password",
    "apiKey":"bob",
    "apiSecret":"lazar",
    "subscriptionId": "15832fd4-4565-40a4-9e55-6e01f28df98b",
    "startDate": "2016-11-11",
    "endDate": "2016-11-21"
}
Related Kill Bill documentation

http://killbill.io/api/#!/usages/getAllUsage

Sample configuration

Following is a sample proxy service that illustrates how to connect to Kill bill with the init operation and use the getUsageOfSubscription  operation. The sample request for this proxy can be found in the  getUsageOfSubscription  sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse" name="getUsageOfSubscription" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="username" expression="json-eval($.username)"/>
         <property name="password" expression="json-eval($.password)"/>
         <property name="apiKey" expression="json-eval($.apiKey)"/>
         <property name="apiVersion" expression="json-eval($.apiVersion)"/>
         <property name="apiSecret" expression="json-eval($.apiSecret)"/>
         <property name="blocking" expression="json-eval($.blocking)"/>
         <property name="subscriptionId" expression="json-eval($.subscriptionId)"/>
         <property name="startDate" expression="json-eval($.startDate)"/>
         <property name="endDate" expression="json-eval($.endDate)"/>
         <killbill.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <username>{$ctx:username}</username>
            <password>{$ctx:password}</password>
            <apiKey>{$ctx:apiKey}</apiKey>
            <apiSecret>{$ctx:apiSecret}</apiSecret>
            <apiVersion>{$ctx:apiVersion}</apiVersion>
            <blocking>{$ctx:blocking}</blocking>
         </killbill.init>
		 <killbill.getUsageOfSubscription>
             <subscriptionId>{$ctx:subscriptionId}</subscriptionId>
             <startDate>{$ctx:startDate}</startDate>
             <endDate>{$ctx:endDate}</endDate>
         </killbill.getUsageOfSubscription>
         <respond />
      </inSequence>
      <outSequence>
         <send />
      </outSequence>
   </target>
   <description />
</proxy>