4.5 Usage Activity API

Usage Activity records are used for metered billing and used in conjunction with a Plan that has one or more Usage based charges. 

4.5.1. Retrieve Usage Activity:

GET /rest/activities?format=xml

GET /rest/activities?format=xml&max=[x]&offset=[z]

GET /rest/activities?format=xml&extCustomerRef=[ref]

GET /rest/activities?format=xml&customerId=[id]

GET /rest/activities?format=xml&orderNumber=[n]

GET /rest/activities?format=xml&invoiceNumber=[z]

GET /rest/activities?format=xml&priceCode=[code]

GET /rest/activities?format=xml&beginDate=[yyyy-MM-dd]

GET /rest/activities?format=xml&beginDate=[yyyy-MM-dd]&endDate=[yyyy-MM-dd]

Notes

Sample Output:


<list>

  <activity id="147">

    <activityBatch id="29" />

    <status>Unbilled</status>

    <chargeDate>2011-08-31</chargeDate>

    <customer id="316" />

    <amount />

    <order id="357" />

    <orderLineItem id="1154" />

    <dateCreated>2011-08-01</dateCreated>

    <extRefId>BL1-00002A</extRefId>

    <quantity>261.00</quantity>

    <chargeEndDate />

    <invoiceText />

    <unitPrice />

  </activity>

  <activity id="148">

  ...

  </activity>

</list>

4.5.2. Create (Upload) Usage Activity:

Usage activity may be uploaded as a batch (with a maximum of 1000 records ber batch).There are 3 critical fields that are required for all Activity records. It is recommend that your calling programs send all the 3 fields if they are available.

The example shows both forms of specifying the required fields.

POST /rest/activities?format=xml



<list>

  <activity> <!-- Note this block uses external IDs -->

    <extRefId>A001</extRefId>

    <extCustomerRef>JOHNDOE001</extCustomerRef>

    <priceCode>STORAGE</priceCode>

    <orderNumber>1007</orderNumber>

    <quantity>10.00</quantity>

  </activity>

  <activity> <!-- Note this block uses internal (BluBilling assigned) IDs -->

    <extRefId>NW003</extRefId>

    <customer id="316" />

    <priceCode>NETWORK</priceCode>

    <order id="357" />

    <quantity>12.50</quantity>

  </activity>

</list>

Notes:

4.5.3. Delete Individual Activity Records:

To delete a record (that has not yet been billed), use the HTTP DELETE call:

DELETE /rest/activity/id?format=xml

DELETE /rest/activity?format=xml&extRefId=[code]

Note that records must be deleted one at a time. The singular form of "activity" is used in the URL (rather than "activities").